Re: Runtime Error in Word 2003

From: Beth Melton (bmelton_at_NoSpam4Memvps.org)
Date: 02/17/05


Date: Thu, 17 Feb 2005 13:06:40 -0600

Do you really *need* the macro? Did you create it?

It's finding all occurrences of two paragraph marks in sequence and
replacing with one.

I don't why it is necessary to run when Word starts considering you
typically start with a blank document anyway....

-- 
Please post all follow-up questions to the newsgroup. Requests for 
assistance by email can not be acknowledged.
~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
"Misha" <Misha@discussions.microsoft.com> wrote in message 
news:62A0F324-6459-4B28-8647-8F43F13010C8@microsoft.com...
> When I open Word 2003 I get this message:
> Runtime error'91'
> Object Variable or With Block variable not set
> When I press Debug, this is the macro which is giving trouble:
> Sub MAIN()
> '
> ' AutoExec.MAIN Macro
> ' Executes when Word for Windows is loaded.
> '
> Selection.Find.ClearFormatting
>    Selection.Find.Replacement.ClearFormatting
>    With Selection.Find.Replacement.ParagraphFormat
>        .SpaceAfter = 12
>    End With
>    With Selection.Find
>        .Text = "^p^p"
>        .Replacement.Text = " ^p"
>        .Forward = True
>        .Wrap = wdFindAsk
>        .Format = True
>        .MatchCase = False
>        .MatchWholeWord = False
>        .MatchWildcards = False
>        .MatchSoundsLike = False
>        .MatchAllWordForms = False
>    End With
>    Selection.Find.Execute Replace:=wdReplaceAll
>
> End Sub
>
> The first line, Selection.Find.ClearFormatting, is highligted in 
> yellow.
> This started happening only this morning. I am not familiar with the 
> macro
> language and have no idea how to fix it. Help, please!
> Thanks 


Relevant Pages

  • Re: macro to extract multiple text selections
    ... Microsoft Office MVP ... MVP FAQ site: http://mvps.org/ ... (which I've called "multispike") ... Where I need help, please, is with getting this macro to loop so ...
    (microsoft.public.word.docmanagement)
  • Re: Performing Cut command shuts down Word
    ... Have you ruled out temp files? ... > I also thought at first that a macro had something to do with it. ... >> Microsoft Office MVP ... >> MVP FAQ site: http://mvps.org/ ...
    (microsoft.public.word.newusers)
  • Re: Performing Cut command shuts down Word
    ... Have you ruled out temp files? ... > I also thought at first that a macro had something to do with it. ... >> Microsoft Office MVP ... >> MVP FAQ site: http://mvps.org/ ...
    (microsoft.public.word.application.errors)
  • Re: Combine two macros into one
    ... Please post all follow-up questions to the newsgroup. ... Microsoft Office MVP ... MVP FAQ site: http://mvps.org/ ... Where <MacroName> is the name of Macro 2. ...
    (microsoft.public.word.docmanagement)
  • Re: [2] Re: Word XP MACRO ! ... err now what ?????
    ... folder. ... - Try running the macro again (place your cursor in the code and press ... Microsoft Office MVP ... Word FAQ: http://mvps.org/word TechTrax eZine: http://mousetrax.com/techtrax/ MVP FAQ site: http://mvps.org/ ...
    (microsoft.public.office.misc)