[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Visual Studio Tools for Office 2005 - Event on closing spreadsheet

Posted on 2006-06-06
5
Medium Priority
?
193 Views
Last Modified: 2010-04-23
Hi

I have a project in which I open an Excel spreadsheet and set a Boolean value to true. (xlAppIsOpen = True)
Is there some kind of event that occurs when xlApp closes so that I can say xlAppIsOpen = False

Thanks
0
Comment
Question by:Murray Brown
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:vb_jonas
ID: 16840555
Workbook_BeforeClose(Cancel As Boolean)
0
 

Author Comment

by:Murray Brown
ID: 16840663
Hi

Thanks.

Where and how do I access this event. My workbook is called xlWb and is opened as follows in a button click event on a form.

xlWb = xlApp.Workbooks.Open("C:\Test.xls",,True)

I am not sure where to place the code that yoou gave me.

Thanks
0
 
LVL 12

Accepted Solution

by:
vb_jonas earned 2000 total points
ID: 16840976

   xlWb = xlApp.Workbooks.Open("C:\Test.xls",,True)
   AddHandler xlWb.BeforeClose, AddressOf ClosingWkBk

   ----------

   Sub ClosingWkBk(ByRef Cancel As Boolean)
         xlAppIsOpen = False
    End Sub
0
 

Author Comment

by:Murray Brown
ID: 16841040
Great! Thanks very much
0
 
LVL 12

Expert Comment

by:vb_jonas
ID: 16841076
:-)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

872 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