Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Decided to put this question in a new message
I have to take a ton of variables and change the names..
Luck has it that they are formatted the same Q9BOB Q10Carl Q11DOB Q12RACE .. .. .. Q149Pre the thing is I have to rename them all and reduce the value by 2. Q7BOB Q8Carl Q9DOB Q10RACE .. .. .. Q147Pre Should I be looking for Numeric or chr substrings to identify what is the number in the variable name that I have to subtract is there a command in the mid statement to find the first chr after a number or how should I go about parsing out the number making sure to get the correct amount of numerics. I assume it will always be mid(1, to take care of the Q but length of the numerics. Should I look for ascii values and find out when the next one is over 57 then I am at the end of the numeric sequence. thank you from a very confused persion...I have all the tools but not sure how to put it together |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Decided to put this question in a new message
Use a macro containing the following code:
Dim srange As Range Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="Q[0-9]{1,}", MatchWildcards:=True, _ MatchCase:=False, Wrap:=wdFindStop, Forward:=True) = True Set srange = Selection.Range.Duplicate Selection.Collapse wdCollapseEnd Selection.MoveRight wdCharacter, 1 srange.Text = "Q" & (Mid(srange.Text, 2) - 2) Loop End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "sparks" wrote in message ... I have to take a ton of variables and change the names.. Luck has it that they are formatted the same Q9BOB Q10Carl Q11DOB Q12RACE . . . Q149Pre the thing is I have to rename them all and reduce the value by 2. Q7BOB Q8Carl Q9DOB Q10RACE . . . Q147Pre Should I be looking for Numeric or chr substrings to identify what is the number in the variable name that I have to subtract is there a command in the mid statement to find the first chr after a number or how should I go about parsing out the number making sure to get the correct amount of numerics. I assume it will always be mid(1, to take care of the Q but length of the numerics. Should I look for ascii values and find out when the next one is over 57 then I am at the end of the numeric sequence. thank you from a very confused persion...I have all the tools but not sure how to put it together |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sending Mail Merge to Email to Multiple Recipients in the Same Mes | Mailmerge | |||
Features | Microsoft Word Help | |||
Request for Help: Sending HTML Email, without any images embedded; details in message body | New Users | |||
Strange spelling message | New Users | |||
Exam question wrong about Word? Opinions, please! | New Users |