G
Gardos Catalin
Hello everybody. I trie to make a macro that print my incoming email that
contains in subject word "Comanda online".
This is the macro:
Private Sub Application_NewMail()
CheckMail
End Sub
Public Sub CheckMail()
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim oOApp As Outlook.Application
Dim oOMail As Outlook.MailItem
Dim InboxItems As Outlook.Items
Dim Mailobject As Object
Dim Subject As String
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.Items
For Each Mailobject In InboxItems
If Mailobject.UnRead Then
Subject = Mailobject.Subject
If Subject = "Comanda online" Then
Mailobject.PrintOut
End If
Mailobject.UnRead = False
End If
Next
Set OlApp = Nothing
Set Inbox = Nothing
Set InboxItems = Nothing
Set Mailobject = Nothing
End Sub
It's working, but i want to print only the body of the email.
Is this possible ?
Thank you.
Hope to reply to me.
url:http://www.ureader.com/msg/1081942.aspx
contains in subject word "Comanda online".
This is the macro:
Private Sub Application_NewMail()
CheckMail
End Sub
Public Sub CheckMail()
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim oOApp As Outlook.Application
Dim oOMail As Outlook.MailItem
Dim InboxItems As Outlook.Items
Dim Mailobject As Object
Dim Subject As String
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.Items
For Each Mailobject In InboxItems
If Mailobject.UnRead Then
Subject = Mailobject.Subject
If Subject = "Comanda online" Then
Mailobject.PrintOut
End If
Mailobject.UnRead = False
End If
Next
Set OlApp = Nothing
Set Inbox = Nothing
Set InboxItems = Nothing
Set Mailobject = Nothing
End Sub
It's working, but i want to print only the body of the email.
Is this possible ?
Thank you.
Hope to reply to me.
url:http://www.ureader.com/msg/1081942.aspx