Hi,
I often refer to the following number format in emails: (XXX-XXXXXX). The first three numbers in each string need to be replaced with a prefix (there are currently about 10 different prefixes in use. I would like to change the prefix to a Letter. For example, I would like to replace 123-456789 with A-456789 and I would like to switch 234-567891 with B-567891 etc.
Is there a code I could employ to automatically swap out the first three numbers for the letter whenever entered in an email? Thanks.
Hi,
There is a similar thread on this forum but i do not know where and i do not remember how to do exactly.It is something like
Ctrl+H
Find:[!4-9]
Replace:A
Before Ok,you have to check the following option:Use...
Last edited by Raiby; 11-10-2009 at 02:39 PM. Reason: deleted spurious quote
First if you are not using Outlook to read your email body you are going to get security messages from Outlook saying that a program is trying to read your emails.
Next I think the trick here is going to be to extract your string out first ie XXX-XXXXXX
I would suggest you look at the LIKE function for example to test if the body of your email has this pattern in it at all you would use
If myBody Like ("*###[-]######*") = True then
do something
end if
Then to extract your string out something like this might work for mysubject or mybody
Code:If mysubject Like ("*###[-]######*") = True Then For i = 1 To Len(mysubject) - 9 If Mid(mysubject, i, 10) Like ("###[-]######") Then yourstring = Mid(mysubject, i, 10) or do here what you want with it before you loop again End If Next End If
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks