Hi,
Not sure if I am posting below query to correct audience.
I am trying to run outlook VBA to find and replace text from original email to new email to bunch of stakeholders. Finding difficulty to run the script.
Scenario, I get an email which has Company Name list. So whenever I am running this script it should replace with company name listed on the original email. Below is my script.
Sub Test()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Dim oRespond As Outlook.MailItem
Dim strcompany As String
Dim strHTML As String
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\test-.oft")
strcompany = InputBox("Issue : ", "Replace %company%")
strHTML = Replace(replyEmail.HTMLBody, "Company:", strissue)
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Subject = replyEmail.Subject & origEmail.Reply.Subject
replyEmail.Display
End Sub
Not sure if I am posting below query to correct audience.
I am trying to run outlook VBA to find and replace text from original email to new email to bunch of stakeholders. Finding difficulty to run the script.
Scenario, I get an email which has Company Name list. So whenever I am running this script it should replace with company name listed on the original email. Below is my script.
Sub Test()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Dim oRespond As Outlook.MailItem
Dim strcompany As String
Dim strHTML As String
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\test-.oft")
strcompany = InputBox("Issue : ", "Replace %company%")
strHTML = Replace(replyEmail.HTMLBody, "Company:", strissue)
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Subject = replyEmail.Subject & origEmail.Reply.Subject
replyEmail.Display
End Sub