I have MSOffice 2007 installed with latest patches. Previously, even with
Excel 2000 on same machine this behavior occurred.
Situation: to isolate using the simplest of examples... a blank XLS (97-2003 format) sheet - no formulas or formatting, and no fancy VBA code. VBAProject code exists in just ThisWorkbook.Workbook_Open event. Even if just one lonely comment character exists within the Workbook_Open event, Excel shuts down when macros are enabled. I am using just the Excel installation, no subsequent add-ins or tweaking or templates modified, added, deleted, manipulated. Macro security is set to lowest. Excel option to trust is granted for VBA.
Example setup: Open a new workbook. Go to VBAProject. For the ThisWorkbook object, enter (or after choosing from drop-down):
Private Sub Workbook_Open()
'
End Sub
The comment character within the event could have been a Msgbox or some other code, but can't get much simpler or more harmless than a comment character! Having any non-blank character or characters in the Workbook_Open event causes Excel to shut down when macros are enabled.
However, if the event was empty of code, as follows:
Private Sub Workbook_Open()
End Sub
then no problem - Excel stays open. Doesn't matter if there are other macros within let's say Module1 or some module name. Only when non-blank character within Workbook_Open event will Excel shut down.
A solution is needed for an XLS (97-2003 format) file.
Cannot use Autpen subroutine within the VBAProject because the workbook is typically opened and manipulated externally from other applications (such as VB component), and the 'caller' will not be using the RunAutoMacros method.
Would appreciate suggestions regarding cause of problem and remedy. Thanks for consideration!
Excel 2000 on same machine this behavior occurred.
Situation: to isolate using the simplest of examples... a blank XLS (97-2003 format) sheet - no formulas or formatting, and no fancy VBA code. VBAProject code exists in just ThisWorkbook.Workbook_Open event. Even if just one lonely comment character exists within the Workbook_Open event, Excel shuts down when macros are enabled. I am using just the Excel installation, no subsequent add-ins or tweaking or templates modified, added, deleted, manipulated. Macro security is set to lowest. Excel option to trust is granted for VBA.
Example setup: Open a new workbook. Go to VBAProject. For the ThisWorkbook object, enter (or after choosing from drop-down):
Private Sub Workbook_Open()
'
End Sub
The comment character within the event could have been a Msgbox or some other code, but can't get much simpler or more harmless than a comment character! Having any non-blank character or characters in the Workbook_Open event causes Excel to shut down when macros are enabled.
However, if the event was empty of code, as follows:
Private Sub Workbook_Open()
End Sub
then no problem - Excel stays open. Doesn't matter if there are other macros within let's say Module1 or some module name. Only when non-blank character within Workbook_Open event will Excel shut down.
A solution is needed for an XLS (97-2003 format) file.
Cannot use Autpen subroutine within the VBAProject because the workbook is typically opened and manipulated externally from other applications (such as VB component), and the 'caller' will not be using the RunAutoMacros method.
Would appreciate suggestions regarding cause of problem and remedy. Thanks for consideration!