Hi All,
I wanted to make an outlook macro which will go to each selected emails and insert comment. The macro is able to insert the comments for the first email in selection but not for the remaining. Is there any solutions. I am basically new to outlook vba.
I want to insert the comment for all the selected emails.
Any help is appreciated.
Below is the code which i have already
I wanted to make an outlook macro which will go to each selected emails and insert comment. The macro is able to insert the comments for the first email in selection but not for the remaining. Is there any solutions. I am basically new to outlook vba.
I want to insert the comment for all the selected emails.
Any help is appreciated.
Below is the code which i have already
Code:
Sub insertcomment()
'-------- Variable Declaration ---------
Dim myolApp As Outlook.Application
Dim msgReply As Outlook.MailItem
Dim myNamespace As Outlook.NameSpace
Dim usname As String
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
'-------- to get the user Name ---------
usname = myNamespace.CurrentUser
'-------- Inputting Current User and Date & Time Stamp --------
Set msgReply = ActiveExplorer.Selection.Item(1) '.Reply
With msgReply
.HTMLBody = "Processed by - " & usname & Space(2) & " - " & Format(Now, "dd-mmm-yyyy" & " - " & "hh:mm:ss AM/PM") & vbNewLine & .HTMLBody
'.Display '- use this if you want to display the email after inserting Date & Time Stamp
End With
End Sub