By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

How to tell if Excel workbook has been closed

P: n/a
I have a VB.net assembly that manipulates excel data. At the end of data
processing, the user has the option to view the spreadsheet, which is at that
time open and not visible. So at this point it's a simple matter of saying
ObjXL.Visible, which works. However, I need to also test to see if the user
has viewed the workbook already and closed it, and then needs to open it
again. My code should test for the state of the Excel.Application as follows:

If ObjXL is still open then
ObjXL.Visible
Else
Re-open workbook using the last path saved
End if

Problem is, I have searched but cannot find a way to test if Excel is
running and, if not, to reload the workbook. I tried Is Nothing but if the
user closes Excel the ObjXL reference is never set to Nothing and persists.

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Nevermind-- answered my own question again!

I check to see if the ObjXL.workbooks.count = 0, and if so, I reload the
workbook. Problem solved!

"Randall Arnold" wrote:
I have a VB.net assembly that manipulates excel data. At the end of data
processing, the user has the option to view the spreadsheet, which is at that
time open and not visible. So at this point it's a simple matter of saying
ObjXL.Visible, which works. However, I need to also test to see if the user
has viewed the workbook already and closed it, and then needs to open it
again. My code should test for the state of the Excel.Application as follows:

If ObjXL is still open then
ObjXL.Visible
Else
Re-open workbook using the last path saved
End if

Problem is, I have searched but cannot find a way to test if Excel is
running and, if not, to reload the workbook. I tried Is Nothing but if the
user closes Excel the ObjXL reference is never set to Nothing and persists.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.