Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder
Set Ns = Application.GetNamespace("MAPI")
Set Folder = Ns.GetDefaultFolder(olFolderInbox)
Set Items = Folder.Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Printattachments Item
End If
End Sub
I made a rule so outlook will automatically print any incoming email with attachment, with exception of few coworkers'email.
If I stop the rule the macro will not be working on its own(supposing it should,Code error?) but if the rule's enabled every email with attachment will be printed twice.
one with every page and one with only the first page. Is there any way to work around this? Kindly assist and thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…