Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I increment list via wildcard search/replace?
If my doc has a list of items like:
(a) (b) (c) etc (not autogenerated), can I increment or decrement this list with a wildcard search or replace? In other words, is there any way to search for (a-z) and replace with \1+2 (replacing b with d) or \1-1 (replacing b with a)? Or would it need to be done via macro? Ed |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I increment list via wildcard search/replace?
It should be simpler to apply autonumbering and then use the wildcard
replace to remove the lettered items . -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: If my doc has a list of items like: (a) (b) (c) etc (not autogenerated), can I increment or decrement this list with a wildcard search or replace? In other words, is there any way to search for (a-z) and replace with \1+2 (replacing b with d) or \1-1 (replacing b with a)? Or would it need to be done via macro? Ed |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I increment list via wildcard search/replace?
I apologize for my ignorance, Graham, but you have absolutely lost me. I
have rarely used the autonumbering, and I can't have an autonumbered section in my finished document, so I am not understanding what I would look for and replace and how to make that happen. Ed "Graham Mayor" wrote in message ... It should be simpler to apply autonumbering and then use the wildcard replace to remove the lettered items . -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: If my doc has a list of items like: (a) (b) (c) etc (not autogenerated), can I increment or decrement this list with a wildcard search or replace? In other words, is there any way to search for (a-z) and replace with \1+2 (replacing b with d) or \1-1 (replacing b with a)? Or would it need to be done via macro? Ed |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I increment list via wildcard search/replace?
Why can't you have an autonumbered section?
If that isn't possible you will have to come up with another plan - such as a macro. eg Sub ReplaceList() Dim vFindText As Variant Dim vReplText As Variant Dim i As Long vFindText = Array("(a)", "(b)", "(c)", "etc") vReplText = Array("(1)", "(2)", "(3)", "etc") With Selection.Find .Forward = True .Wrap = wdFindContinue .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Format = True .MatchCase = True For i = LBound(vFindText) To UBound(vFindText) .Text = vFindText(i) .Replacement.Text = vReplText(i) .Execute replace:=wdReplaceAll Next i End With End Sub (see http://www.gmayor.com/installing_macro.htm ) Add in the rest of the letter/number sequences in the two arrays. Unless you have a lot of lists it would be quicker just to edit the document manually than create the macro -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: I apologize for my ignorance, Graham, but you have absolutely lost me. I have rarely used the autonumbering, and I can't have an autonumbered section in my finished document, so I am not understanding what I would look for and replace and how to make that happen. Ed "Graham Mayor" wrote in message ... It should be simpler to apply autonumbering and then use the wildcard replace to remove the lettered items . -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: If my doc has a list of items like: (a) (b) (c) etc (not autogenerated), can I increment or decrement this list with a wildcard search or replace? In other words, is there any way to search for (a-z) and replace with \1+2 (replacing b with d) or \1-1 (replacing b with a)? Or would it need to be done via macro? Ed |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I increment list via wildcard search/replace?
Why can't you have an autonumbered section?
I can create an autonumbered section during the drafting of the report, but when it goes out from me it must be "plain text". The report reviewers, though, will often want things adjusted, paragraphs inserted or deleted, etc. I've had lists spanning pages, running from (a) to (z), starting over with (aa), and finally ending with (ddd)! Most, though, are five to 15 items. We alternate numbers and letters, so indents are numbered as: 2.1.3 a. (1) (2) (a) (b) b. etc. If they want two paragraphs inserted before a., then I have to go through the entire list and increment everything at that indent level up two. I just didn't know if there was any way to use a wildcard or pattern match to pull out the letter identifier and add or subtract the required number. Just had a thought - perhaps a Find, then isolate the identifier. If it's a number, increment up or down and replace the string using the new number. If it's a letter, use Asc() to return the character code and increment _that_ number, then use Chr() with the new number in the replacement string. Does this sound like it might work? Ed "Graham Mayor" wrote in message ... Why can't you have an autonumbered section? If that isn't possible you will have to come up with another plan - such as a macro. eg Sub ReplaceList() Dim vFindText As Variant Dim vReplText As Variant Dim i As Long vFindText = Array("(a)", "(b)", "(c)", "etc") vReplText = Array("(1)", "(2)", "(3)", "etc") With Selection.Find .Forward = True .Wrap = wdFindContinue .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Format = True .MatchCase = True For i = LBound(vFindText) To UBound(vFindText) .Text = vFindText(i) .Replacement.Text = vReplText(i) .Execute replace:=wdReplaceAll Next i End With End Sub (see http://www.gmayor.com/installing_macro.htm ) Add in the rest of the letter/number sequences in the two arrays. Unless you have a lot of lists it would be quicker just to edit the document manually than create the macro -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: I apologize for my ignorance, Graham, but you have absolutely lost me. I have rarely used the autonumbering, and I can't have an autonumbered section in my finished document, so I am not understanding what I would look for and replace and how to make that happen. Ed "Graham Mayor" wrote in message ... It should be simpler to apply autonumbering and then use the wildcard replace to remove the lettered items . -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Ed wrote: If my doc has a list of items like: (a) (b) (c) etc (not autogenerated), can I increment or decrement this list with a wildcard search or replace? In other words, is there any way to search for (a-z) and replace with \1+2 (replacing b with d) or \1-1 (replacing b with a)? Or would it need to be done via macro? Ed |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with Wildcard search/replace, please? | Microsoft Word Help | |||
Mail Merge a Letter to a Distribution List | Mailmerge | |||
Mail Merge from Outlook Distribution List | Mailmerge | |||
Drop down list from another drop down list in Word? | Microsoft Word Help | |||
How do I continue numbering from one list style to another? | Microsoft Word Help |