View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Just having App_WorkbookOpen crashes Excel

XL2003 works just fine. I even went to the extent of instantiating an
object of the class and initializing the App object with the code below
(in a standard module):

Option Explicit
Dim x As Class1
Sub testIt()
Set x = New Class1
Set x.App = Application
End Sub
Sub resetIt()
Set x = Nothing
End Sub

Basically, I ran the testIt code, then opened the text file.
Everything worked just OK.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , says...
Hi,

I have workbook with an EventClass whose contents are included below. All
methods are blank. However, just having those blank templates causes Excel
to crash (with 100% consistency) when I try to open a text file a.txt with
the following contents:
1 2
3 4
5 6

I get to tell excel how to parse it (Fixed width or Delimited) but when I
click Finish, the crash occurs.

If the workbook containing this event class is not open, no crash occurs.
Opening an excel workbook rather than a parsable text file is no problem.

Thank you so much for helping me.

Aaron

Option Explicit

Public WithEvents App As Application
Private Sub App_NewWorkbook(ByVal wb As Excel.Workbook)
End Sub
Private Sub App_SheetActivate(ByVal Sh As Object)
End Sub
Private Sub App_WorkbookOpen(ByVal inWB As Excel.Workbook)
End Sub