Solved

Using Excel

Posted on 1998-09-30
3
165 Views
Last Modified: 2010-04-30
I am using Excel book as a object in VB program.

This is how I decalred

Dim WithEvents xlApp As Excel.Application
Dim WithEvents xlSheet As Excel.Worksheet
Dim WithEvents xlBook As Excel.Workbook

and I am opening the file through get object

 Set xlBook = GetObject(path)
   
    xlBook.Application.Visible = True
    xlBook.Windows(1).Visible = True
   Set xlSheet = xlBook.ActiveSheet

When the user tries to close the file from excel I have to popup a form which asks whether the user want to save it or not, so I am trapping the before close event

Private Sub xlBook_BeforeClose(Cancel As Boolean)
form to be displayed
End Sub

after this event I have to return to excel, but the problem is then excel is throwing it's dialog box askinh whether the user want to save with YES,NO,CANCEL options. I don't want it to be dispalyed. SO how can I send a Cancel message to excel before coming out of the before close function. No matter what the user opted in my form.
0
Comment
Question by:lesa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 10 total points
ID: 1437350
Use

Application.ActiveWorkbook.Saved = True

and you won't be promped



Regards
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1437351
Application.ActiveWorkbook.Saved = True

This don't save the workbook.
Just prevent from getting the message
0
 

Author Comment

by:lesa
ID: 1437352
Sorry for the delay
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question