Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I catch if the USER closes Excel which I opened from the
external application in VB.NET? Users can open and interact with a spreadsheet, but how can I tell when they close Excel? I need to set my variables (xlApp) to nothing and do other stuff Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you could use an automatic before_close macro to reset all your
variables, etc..... although i'm not sure if that will work in vb.net. Private Sub Workbook_BeforeClose (Cancel as Boolean) .... your code... End sub susan On Mar 22, 1:37 pm, wrote: How can I catch if the USER closes Excel which I opened from the external application in VB.NET? Users can open and interact with a spreadsheet, but how can I tell when they close Excel? I need to set my variables (xlApp) to nothing and do other stuff Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In VB, I'd use a With Events
Dim WithEvents XLApp As Excel.Application Private Sub CommandButton1_Click() Set XLApp = New Excel.Application End Sub Private Sub XLApp_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean) MsgBox "Closing WB: " & Wb.Name End Sub However, I would have thought that as your app holds a reference to the XLApp, the XL instance cannot close, although the user may dimiss the UI. There is no Excel event like "Excel_BeforeClose" Is this for an addin ? NickHK wrote in message oups.com... How can I catch if the USER closes Excel which I opened from the external application in VB.NET? Users can open and interact with a spreadsheet, but how can I tell when they close Excel? I need to set my variables (xlApp) to nothing and do other stuff Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I start a new excel program for each opened excel file? | Setting up and Configuration of Excel | |||
Run macro when file is opened and closed | Excel Programming | |||
How do I tell if user has closed Excel. | Excel Programming | |||
how do i disable "running virus scan" in excel program when opened | New Users to Excel | |||
save Wsh to closed/opened WB | Excel Programming |