Solved

Using Excel

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to parse out a json string in VB6? 10 218
Formula problem with Excel attachment 6 38
Error with a code discussed on this page 5 29
Dinamic report to Crosstab query 9 33
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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