Reputation: 123
I am trying to create a macro in outlook that opens a file in excel and runs a procedure from that file. This code does that beautifully...
Dim ExApp As Excel.Application
Dim ExWbk As Workbook
Set ExApp = New Excel.Application
Set ExWbk = ExApp.Workbooks.Open("D:\Control Verification\Controls Verification Updated.xlsm")
ExApp.Visible = False
ExWbk.Application.Run "Module1.Email_All"
ExWbk.Close SaveChanges:=False
When someone opens this workbook normally I have a userform
automatically display to allow the user to select different things, BUT when I open it from Outlook I don't want this userform
to display.
I only need access to a different procedure in the userform that doesn't require any selections. Any ideas? Thanks.
Upvotes: 2
Views: 816
Reputation: 12499
Work with Application.EnableEvents Property for disabling the Events before you open the workbook
Example
ExApp.EnableEvents = False ExApp.Workbooks.Open("Path") ' < Your code here ExApp.EnableEvents = True
Upvotes: 4