M
Misha
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
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