Tina
07-05-2017, 08:03 AM
I have two macros in Outlook 2010 that work
The first prints an email when it is dropped into a folder. The second one prints the first page of an email. Ideally I want to combine them both but after some experimenting I can't seem to insert the second set of code into the first in the correct place for it to work.
Any help much appreciated
Code one
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderInbox).Parent.Folders("Worldox").Folders(“Joey”).Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
PrintNewItem Item
End If
End Sub
Private Sub PrintNewItem(Mail As Outlook.MailItem)
On Error Resume Next
Mail.PrintOut
End Sub
Code two
Sub PrintPageOne()
SendKeys "%FPR"
SendKeys "%S"
SendKeys "1"
SendKeys "{ENTER}"
End Sub
The first prints an email when it is dropped into a folder. The second one prints the first page of an email. Ideally I want to combine them both but after some experimenting I can't seem to insert the second set of code into the first in the correct place for it to work.
Any help much appreciated
Code one
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderInbox).Parent.Folders("Worldox").Folders(“Joey”).Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
PrintNewItem Item
End If
End Sub
Private Sub PrintNewItem(Mail As Outlook.MailItem)
On Error Resume Next
Mail.PrintOut
End Sub
Code two
Sub PrintPageOne()
SendKeys "%FPR"
SendKeys "%S"
SendKeys "1"
SendKeys "{ENTER}"
End Sub