Cyberdude
07-25-2006, 03:27 PM
I have a macro in workbook ?A? that opens workbook ?B? just before it exits using the following code:
Workbooks.Open Filename:="C:\Excel Documents\WorkbookB.xls"
Application.Run "'WorkbookB.xls'!UpdateButtonMsgValue"
Workbooks(ActiveWorkbook.Name ).Activate
Workbook ?B? is supposed to execute the ?Workbook_Open? macro when it is opened, and it does most if not all of the time. When it executes, it performs some data loading into workbook ?B?. I have an error checking mechanism in place to detect if that initialization does not occur. Once in awhile, the error message is triggered, but most of the time it works just fine. My question is, why are there occasions when the initialization doesn?t occur? Then I wondered if it has something to do with the ?Run? statement in my example above.
Actually I want to know if the ?Workbook_Open? macro runs to completion BEFORE the ?Run? statement is executed, or does ?Workbooks.Open Filename? statement just start the open process, then passes control to the next statement (the ?Run? statement in this case), so that at times the ?Run? statement starts executing before the file open process is completed. I?m skeptical that this happens, but I thought I?d better ask.
Workbooks.Open Filename:="C:\Excel Documents\WorkbookB.xls"
Application.Run "'WorkbookB.xls'!UpdateButtonMsgValue"
Workbooks(ActiveWorkbook.Name ).Activate
Workbook ?B? is supposed to execute the ?Workbook_Open? macro when it is opened, and it does most if not all of the time. When it executes, it performs some data loading into workbook ?B?. I have an error checking mechanism in place to detect if that initialization does not occur. Once in awhile, the error message is triggered, but most of the time it works just fine. My question is, why are there occasions when the initialization doesn?t occur? Then I wondered if it has something to do with the ?Run? statement in my example above.
Actually I want to know if the ?Workbook_Open? macro runs to completion BEFORE the ?Run? statement is executed, or does ?Workbooks.Open Filename? statement just start the open process, then passes control to the next statement (the ?Run? statement in this case), so that at times the ?Run? statement starts executing before the file open process is completed. I?m skeptical that this happens, but I thought I?d better ask.