Need help with simple macro

E

Erik

I need a macro that will loop thru a word document and look for words with a
certain font size (say 18). Then change the style of those words to Heading
2, and 'bulletize' the word using a numbered list. I'm having problems
getting it to look at individual words.

Thanks in advance for any help.
 
E

Edward Thrashcort

Supposing there is more than one such work on a single line?
How do you plan to deal with that?

Why not use find and replace?

Eddie
 
B

Bill Foley

The simple fix might have already been done, but if you change the path of
your Startup folder, you need to close Word then re-open Word before this
template toolbar will show up.
 
D

Doug Robbins

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Font.Size = 18
With Selection.Find
Do While .Execute(FindText:="*", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
Selection.Paragraphs(1).Style = "Heading 2"
Selection.Paragraphs(1).Range.Select
Selection.Collapse wdCollapseEnd
Loop
End With

The bulletizing should be taken care of by the definition of the style.

--
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
 
E

Erik

Thanks Doug. That seems to work, but it appears to get stuck in an endless
loop, and I have to terminate Word to get out of it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top