Hi all,
after days of (unsuccessful) research in the web and another forum I try my luck here.
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 can understand this since the Outlook reference is not yet set and this is what I exactly try to do in the Workbook_Open event. This workbook is going to be used by multiple users. How does Excel work here? Does Excel first try to compile the COMPLETE project BEFORE it executes ANY code (e.g. 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 any help/workaround. I can also accept an answer like: "Alex, you're screwed - there is no solution"
after days of (unsuccessful) research in the web and another forum I try my luck here.
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 can understand this since the Outlook reference is not yet set and this is what I exactly try to do in the Workbook_Open event. This workbook is going to be used by multiple users. How does Excel work here? Does Excel first try to compile the COMPLETE project BEFORE it executes ANY code (e.g. 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 any help/workaround. I can also accept an answer like: "Alex, you're screwed - there is no solution"