ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dueling programs (https://www.excelbanter.com/excel-programming/340643-dueling-programs.html)

quartz[_2_]

Dueling programs
 
I am using Office 2003 on Windows XP.

Is there a way when opening a second file programmatically, to allow the
second file's ON_OPEN event code to finish before performing other tasks with
it from the first file?

e.g. User is in File1 and triggers File2 to open. File1 waits for File2's
ON_OPEN code to finish, then File1's code resumes...

I tried pausing my code in the calling file, but I still get "Application
Defined Error".

Any suggestions?

Dave Peterson

Dueling programs
 
That's the way it's supposed to work. Excel isn't multithreaded (if I used that
correctly).

It starts something (like the workbook_open event, it'll finish that before
returning to the original code).

Are you opening the second workbook in the same instance of excel? (That could
make a difference, since there would be two copies of excel running.)



quartz wrote:

I am using Office 2003 on Windows XP.

Is there a way when opening a second file programmatically, to allow the
second file's ON_OPEN event code to finish before performing other tasks with
it from the first file?

e.g. User is in File1 and triggers File2 to open. File1 waits for File2's
ON_OPEN code to finish, then File1's code resumes...

I tried pausing my code in the calling file, but I still get "Application
Defined Error".

Any suggestions?


--

Dave Peterson


All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com