Hi My below piece of code works perfectly but when i change
Code:
Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderInbox)
to
Code:
Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderSentMail)
it doesnt work..
below is my full code.. please help me.
Code:
Dim olApp As Outlook.Application
Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim i As Integer
olApp = New Outlook.Application
olNs = olApp.GetNamespace("MAPI")
Dim Fldr As MAPIFolder
Dim objOwner As Outlook.Recipient
objOwner = olNs.CreateRecipient("HPI-API-IPGUS")
objOwner.Resolve()
If objOwner.Resolved Then
MsgBox(objOwner.Name)
Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderSentMail)
i = 1
For Each olMail In Fldr.Items
If InStr(olMail.Subject, "Invoice to Post") <> 0 Then
With olMail.ReplyAll
.HTMLBody = "Hi" & vbCrLf & .HTMLBody
.Display()
End With
End If
Next
End If