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
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.