Solved

Using Excel

Posted on 1998-09-30
3
160 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now