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

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
 
M

Michael Bauer [MVP - Outlook]

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:
 
R

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top