App events behave differently in diff. versions

  • Thread starter Thread starter aah-boy
  • Start date Start date
A

aah-boy

Hi,

I'm using the code listed below in Excel98 to trap workbooks opening -
so I can do a scan for invalid data. This code works fine except for
workbooks created and attached to Outlook97 messages - I'm currently
using Office98 and all spreadsheets attached using 98 and 2000 work
fine.

Does anyone know why a workbook created in Excel97 will cause this
code to (seemingly) not be entered at all - I tried msgbox as soon as
it loads and it never displays.

I'm now getting deeply confused as to where the fault lies.

Please, any help is much appreciated.

Dave



In workbook.....


Option Explicit

Dim AppClass As New EventClass

Private Sub Workbook_Open()

Set AppClass.App = Application

End Sub


In EventClass module........


Option Explicit

Public WithEvents App As Application

Private Sub App_WorkbookOpen(ByVal Wb As Excel.Workbook)

MsgBox ("Loading: " & Wb.Name)

End Sub
 
Hi Dave. Your problem does not seem to involve Outlook VBA, and is strictly
an Exel issue. You should repost this to m.p.excel.programming and
hopefully someone will help you there.

BTW, it doesn't matter which version of Outlook is storing your workbooks as
an attachment in an e-mail message; when the spreadsheet opens, it's
essentially unaware of it's container (Outlook in this case). You may want
to try working with a saved, local copy of that spreadsheet; attachments are
opened in memory or stored as a temporary file (I'm not quite sure) and may
cause problems if you treat them like a regular file.
 
Back
Top