I created a custom folder on outlook with name “MyTemplate” and inside that folder an email message with subject Auto Plan
( It is a template email with oft extension) ,
and inside that email an excel workbook.
For automation purpose, I need after I open that email message, then a copy of the attached workbook will be opened automatically.
I found the below code, But I cannot utilize it to fulfil my need.
Notes: for testing purpose I set outlook and excel macro security settings to “Enable all macros”.
That is my own email meassge (I fully trust) ,I also added the a personal digital certificate to the workbook and ThisOutlookSession
.
I am using outlook 2016 32Bit with Windows 10 64Bit.
As always, grateful for any assistance.
Public WithEvents myItem As Outlook.MailItem
Public EventsDisable as Boolean
Private Sub Application_ItemLoad(ByVal Item As Object)
If EventsDisable = True Then Exit Sub
If Item.Class = olMail Then
Set myItem = Item
End If
End Sub
Private Sub myItem_Open(Cancel As Boolean)
EventsDisable=True
'Your code
EventsDisable=False
End Sub