Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Opening Excel workbook via automation doesn't fire event procedures?

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
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





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Opening Excel workbook via automation doesn't fire event procedures?

Hi Nick,
Thanks for the reply. Do you think the fact that I'm using late binding
could have anything to do with it?

It's strange. I realize now that not only is the open event firing but XL
it's like its opening in safe mode. Meaning add-ins aren't loaded either.
hmmm...

Trying a reboot now to see if it's something weird with my machine.
Doubtful but worth a try.

-Jeremy

NickHK wrote:
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Private Sub Workbook_Open() event won't fire if workbook is hidden? Mike Weaver Excel Programming 2 February 15th 06 01:38 PM
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Workbook Open event does not fire Robots Excel Programming 2 December 3rd 04 11:26 PM
Workbook Open Event does not fire Jon Somerset Excel Programming 1 October 15th 04 12:49 PM
Event Procedures: Event on Worksheet to fire Event on another Worksheet Kathryn Excel Programming 2 April 7th 04 07:35 PM


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"