A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 21st 08, 07:09 PM posted to microsoft.public.outlook.program_vba
RogerM[_2_]
external usenet poster
 
Posts: 5
Default How to replace text upon receipt of message using a Rule?

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


  #2  
Old November 24th 08, 05:39 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to replace text upon receipt of message using a Rule?



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

  #3  
Old November 26th 08, 03:28 AM posted to microsoft.public.outlook.program_vba
RogerM[_2_]
external usenet poster
 
Posts: 5
Default How to replace text upon receipt of message using a Rule?

Thanks Michael

~Roger
"Michael Bauer [MVP - Outlook]" wrote in message
...


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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I do a global text replace for all contacts? Mike Outlook - Using Contacts 3 April 23rd 08 12:01 AM
Associate contact and read receipt rule [email protected] Outlook - General Queries 1 August 24th 07 05:59 PM
Rule to auto reply using a dynamic text file as attachment or message body DF Outlook - General Queries 0 June 29th 07 07:38 PM
Search & Replace Text in the Body of a Message dch3 Outlook and VBA 1 June 7th 07 04:45 AM
Read receipt Setting via Rule John Outlook - General Queries 1 May 11th 06 04:50 PM


All times are GMT +1. The time now is 09:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.