How can I automate my Macro?

M

MichaelB

Hello,

I have the below Marco which will reformat a selected section of text,
clearing the format and then implementing new formatting. This works fine but
I am finding that I have tens of thousands of modifications within one
document that must be made. Is it possible to have this macro search for a
desired string of text (like “Justification:â€), then automatically select the
string and following text to the next hard return (¶) and then perform the
reformatting options? It would be nice to automate this process for going
through 589 pages searching for this is getting very tedious.

Any help would be greatly appreciated.
Mike



Sub fix_Paragraph1_Font_Bold()
'
' Macro to clear all formatting on selected text and then re-implement the
‘ proper paragraph 1 style with the first section (up to the “:â€) being set to
‘ paragraph 1 + Bold Font
'
Selection.ClearFormatting
Selection.ClearFormatting
Selection.Style = ActiveDocument.Styles("Paragraph 1")
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = "*:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Font.Bold = wdToggle
Selection.HomeKey Unit:=wdLine
End Sub
 
C

Charles Kenyon

Before you go too far with writing macros to handle formatting, look into
Styles.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
M

MichaelB

Charles,

This is one the problems I am having, there are several styles being used
(for this is a document which expands several Word versions) which I am
attempting to cleaning up, Notice the clear formatting. I am then trying to
standardize the text into the Paragraph 1 style with the first part (up to
the “:â€) being bolded. I just need help in getting this wrapped into a loop
which will automate the tasks. I need to find all occurrences of specific
text then highlight the entire paragraph, remove any formatting that exists
and then implement the proper style.

Again any help would be greatly appreciated.
Mike
 

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