Outlook VBA. Open a PDF document and find a word inside it.
Hello,
I'm trying open a PDF document (attached document in eMail) with VBA and find a word inside it. If this word exist on it then "category = Red"
Is it possible in Outlook VBA? I don't find examples about it.
(code for example from Graham Mayor, gmayor).
Public Sub PDF_eMails()
'==========================================
'Declare variables:
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.Folder
'Dim myDestFolder As Outlook.Folder
'Set variables:
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
'Set myDestFolder = myInbox.Folders("CHECK")
'===========================================
'Declare the variable MyItem but don't set it:
Dim myItem As Outlook.MailItem
For Each myItem In Application.ActiveExplorer.Selection
If myItem.UnRead Then
If "WORD EXIST IN PDF" Then
myItem.Categories = "Red"
myItem.Save
End If
End If
Next myItem 'This loops onto the next item in the selection or folder,
'so it checks them all automatically.
End Sub