Hi all,
after hours of research in the web I finally need to ask here for your help: Following problem: I try to add a reference (Outlook library) in the Private Sub Workbook_Open() event (yes, it's in ThisWorkbook) since I need early binding for getting Outlook events later in different places. Once I open my workbook I get a compile error "user-defined type not defined" in my class module here --> Private olApp As New Outlook.Application. I understand this since the Outlook reference is not yet set and this is what I exactly try to do in the Workbook_Open event. How does Excel work here? Does it first try to compile the project BEFORE it executes code in the Workbook_Open event (enableEvents is set to True)?
Once I run the Sub Workbook_open manually, the reference is set without any problems.
Thanks in advance for your help.
Trying to add reference for MS Outlook Object Library when Workbook opens:
Here the Class Module "ClsAppoint" in which the compile error occurs once I open the workbook (red line):
Bookmarks