How to replace text upon receipt of message using a Rule?

  • Thread starter Thread starter RogerM
  • Start date Start date
R

RogerM

I'm trying to run a sript that will execute when an email message arrives
that will replace ]] with %5D%5D. I've tried the code below, but keep keep
getting an error that a user-defined type isn't defined. Maybe the code
below isn't even close for what I'm trying to accomplish, I don't know.
Any assistance would be appreciated. ~ Roger

Sub FixHyperlink(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
Dim strText As Object

strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
strText = objMail.Body

With objMail.Body
strText = Replace(strText, "]]", "%5D%5D")
End With

objMail.Save

Set objMail = Nothing

End Sub
 
Sub FixHyperlink(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
Dim strText As String

strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
strText = objMail.Body

strText = Replace(strText, "]]", "%5D%5D")
objMail.Body = strText
objMail.Save

Set objMail = Nothing

End Sub

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Fri, 21 Nov 2008 12:09:50 -0600 schrieb RogerM:
 
Thanks Michael

~Roger
Michael Bauer said:
Sub FixHyperlink(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
Dim strText As String

strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
strText = objMail.Body

strText = Replace(strText, "]]", "%5D%5D")
objMail.Body = strText
objMail.Save

Set objMail = Nothing

End Sub

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Fri, 21 Nov 2008 12:09:50 -0600 schrieb RogerM:
I'm trying to run a sript that will execute when an email message arrives
that will replace ]] with %5D%5D. I've tried the code below, but keep keep
getting an error that a user-defined type isn't defined. Maybe the code
below isn't even close for what I'm trying to accomplish, I don't know.
Any assistance would be appreciated. ~ Roger

Sub FixHyperlink(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
Dim strText As Object

strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
strText = objMail.Body

With objMail.Body
strText = Replace(strText, "]]", "%5D%5D")
End With

objMail.Save

Set objMail = Nothing

End Sub
 
Back
Top