Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbooks.Open suppresses MsgBox Displays when Macro is run
Greetings! This problem has me really stumped. I am running VBA in Excel
2007. My operating system is Windows XP Pro. (The problem also occurs when the OS is Windows Vista.) The following VBA code runs perfectly when I run it in the VBE via F5, displaying both the message "BFROPEN", the message "AFROPEN", and the message "Finished!": Application.DisplayAlerts = True If Dir("C:\Documents and Settings\Mike\IIR\Book1.xlsm") < "" Then ' Book1.xlsm exists MsgBox "BFROPEN" Workbooks.Open ("C:\Documents and Settings\Mike\IIR\Book1.xlsm") MsgBox "AFROPEN" Else MsgBox "PROBLEM" End If MsgBox "Finished!" But if I include the above code in a VBA macro, assign the macro a hot key, and run it by typing the hot key, the message "BFROPEN" is displayed and file Book1.xlsm is opened, but the message "AFROPEN" is not displayed. The message "Finished" isn't displayed either. I suspect that there is something strange about the behaviour of Workbooks.Open when it is an instruction in a macro which is being executed. Any help or suggestions for further debugging will be extremely appreciated. May you have a blessed day. Sincerely, Michael D Fitzpatrick "EvangelMike" |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run Macro In All Open Workbooks | Excel Discussion (Misc queries) | |||
Macro to merge open workbooks | Excel Discussion (Misc queries) | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Open two new workbooks with macro | Excel Programming | |||
help with macro to open and close workbooks | Excel Programming |