New Word Macros won't run

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Problem: Office 2003 60 dya trial was pre-installed on my New computer. I
imported my old macros and they worked great. However, I created a new
macro, and made a mistake, so I went to the editor to edit, and now the macro
won't run, nor will any new macro that I record. All the old macros still
work. I'd generally be classified as a power user, but I don't typically
edit macros, I simply record simple macros to find and highlight text in
documents I'm researching.

Solutions Attempted so far.
1) Deleted all macros, rebooted and started over. Same Result
2) Reimported old macros and tried again. Same Result
3) Uninstalled MS Word, rebooted, reinstalled. Same Result.

Any ideas?
 
Looks like you somehow changed your macro security setting to high. I would
check it.
--
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

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
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.
 
Graham,
Thanks for the response. I wiped the machine, installed XP and a full
version (not trial) of Office 2003, and all my other software. Same problem,
macro will not run. Let me revise that, the MACRO runs, but does nothing
(the screen races and jumps around the document like it's running). So I
learned it was most likely not a mistake I made in editing that caused the
problem. I have 2 freshly installed winXP machines, one I imported old
macros - they work fine, AND newly macros won't work. The other machine, I
didn't import the old macros, but the a a newly recorded macro won't work.

I'm creating very simple macros. Search for a specific word in a document,
and replace it with the same word - but make it BOLD and RED. Very simple
stuff.

Now I'll jump below and answer your questions.

Graham Mayor said:
How did you import all your old macros?
**** I stored the macros in a document, the opened it on the new machine,
and used Macros/Organize and moved them to Normal.doc. The work great.
Does this machine have the full version of Acrobat 7 installed? If so, see
http://www.gmayor.com/lose_that_adobe_acrobat_toolbar.htm
**** I only have adobe reader version 7 installed.
Not all the search functions are available to the macro recorder. Some you
would have to create manually.
**** You read above the kind of simple macros I'm creating, is this
functionality available?
 
Unfortunately, you cannot record the type of macro that searches for a word
and applies formatting. The formatting commands are not recorded, as you
will see if you examine the code in the macro editor.

The following code demonstrates how to do something similar using manual
editing of the macro. In this instance it looks for all text formatted as
Ariel/Bold/12 point and replaces with BookmanOldStyle/Italic/11 point.
Change the relative parts of the code to suit your requirements.

Sub ReplaceExample()

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'**********************
.Text = ""
.Font.Name = "Arial"
.Font.Bold = True
.Font.Size = "12"

.Replacement.Text = ""
.Replacement.Font.Name = "Bookman Old Style"
.Replacement.Font.Size = "11"
.Replacement.Font.Italic = True
'**********************
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Use code such as the following (change "fox" to whatever word it is to which
you want to apply the formatting

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
While .Execute(FindText:="fox", MatchWildcards:=False, Wrap:=wdFindStop,
Forward:=True) = True
Selection.Font.Bold = True
Selection.Font.Color = wdColorRed
Wend
End With

You will see that there is no comparison between the above code and what you
get by using the macro "recorder".

--
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
 
Thanks to Graham Mayor & Doug Robbins - Both of thier responses gave me the
hints I needed to solve the problem.

1) PROBLEM: Somewhere between MS Office 2000 and 2003 - the Macro Recorded
was changed and no longer allows "recording" the functions I was familiar
with using. As it turned out, this was the source of my problems.

2) SOLUTION: Code the macro manually. Here's a working code sample, should
someone need the same functionality. It looks as though there are a number
of ways to do the same thing. This sample will let you search for the word
"Microsoft", and then replace it with GREEN / BOLDED "Microsoft".

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Bold = True
.Color = wdColorGreen
End With
With Selection.Find
.Text = "Microsoft"
.Replacement.Text = "Microsoft"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Thanks for the help!

=TexasBBQ=
Austin, TX
 
Back
Top