View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Opening Excel workbook via automation doesn't fire event procedures?

Jeremy,
Workbook_Open() fires when its WB is opened by automation. This works for
me, so I'm not sure why yours is not.
However, Auto-Open routines have to be called in order to run.

NickHK


"Jeremy Gollehon" wrote in message
...
From Access I'm using the following code to open an instance of XL

invisibly
in the background. The workbook is doing some heavy calculations and
handing answers back to Access.

--------------------------------------------------------------
If Not IsFileOpen(sFileAndPathName) Then
Set appXL = CreateObject("Excel.Application")
Set appXLWB = appXL.Workbooks.Open(sFileAndPathName, UpdateLinks:=0)
End If
--------------------------------------------------------------

When the Access app is closed it closes the workbook along with it.
However, if the Access app is ctl-alt-deleted, the XL workbook is left
orphaned on the users machine. To solve this problem I kick off a timer
from the Workbook_Open event. Every 10 minutes it checks if it's Access
companion is open and if not it closes itself.

This works great in testing (opening the XL file by double clicking it)

but
when Access opens the workbook (using the above code) the Workbook_Open
event isn't firing. I tried using Auto_Open from a sub with the same
result.

How can I get the Open event to fire? What am I missing?

Thanks for any help.
-Jeremy