Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Wildcard search/replace, please? Ed Microsoft Word Help 1 July 14th 06 12:48 AM
Mail Merge a Letter to a Distribution List Akiyama Mailmerge 2 April 20th 06 10:32 PM
Mail Merge from Outlook Distribution List Alamansky Mailmerge 3 March 19th 06 08:22 AM
Drop down list from another drop down list in Word? gobonniego Microsoft Word Help 1 December 20th 05 07:46 PM
How do I continue numbering from one list style to another? Dan M Microsoft Word Help 4 October 20th 05 08:59 PM


All times are GMT +1. The time now is 03:02 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"