View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 279
Default Debug.Print statement causes Excel crash

In message of
Sat, 15 Jun 2013 23:48:43 in microsoft.public.excel.programming,
writes
On Saturday, June 15, 2013 1:06:07 PM UTC+2, wrote:
After some search effort I found the cause for an Excel crash. Just
in case you experience the same this is what I discovered: In Excel
2003, 2007 (and later?) the statement Debug.Print , "test" causes
Excel to crash. There is an <empty expression in front of the comma.
The crash occurs only when a piece of VBA is executed without the
Visual Basic editor window opened.


Try This: Add a module with the following sub:

Private Sub Auto_Open()
Debug.Print , "Test"
End Sub

Save and close the Excel document; Close the Excel application.
Then open the Excel document from the Windows Explorer and allow the
macro to run. Excel will crash: "Microsoft Office Excel has encountered
a problem and needs to close. We are sorry for the inconvenience."


Thanks for trying again. I did not bother reporting my failure to make
Excel 2003 crash with your earlier description.

I am sorry to report that I tried what you said and Excel did not crash.
When I followed up the opening with Alt+F11 to open the Visual Basic
Editor, I see the code:
Private Sub Auto_Open()
Debug.Print , "Test"
End Sub
and an Immediate window showing:
Test

Do you have a second machine on which to repeat the test with a clean
Excel installation?

I am afraid I can only say what a developer used to say to me, "It works
on my machine." ;)
--
Walter Briscoe