J
Joel Berry
I just upgraded to Office Professional 2003 from Office Professional XP.
The following code, when executed, completely and irrevocably crashes
Microsoft Excel 2003 at the line <.Text = "^pDescription">. It worked just
find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every
time. Easily reproducible. I have updated to all service packs/patches, etc.,
too.
Also, the line <Selection.Find.Replacement.ClearFormatting> gives a
"Automation error: the procedure number is out of range" error, which it
didn't do before in Excel 2003.
What the heck happened between the two versions? Now my code has completely
blown up!!! Any ideas????? Any help would be greatly appreciated, as we have
to get this program up and running for production! Thanks!!!
Public Sub Test()
Dim appWord As Word.Application
Set appWord = New Word.Application
appWord.Documents.Add
appWord.Selection.Find.ClearFormatting
appWord.Selection.Find.Replacement.ClearFormatting
With appWord.Selection.Find
.Text = "^pBREAK"
.Replacement.Text = "-----"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
appwordSelection.Find.Execute Replace:=wdReplaceAll
appWord.ActiveDocument.SaveAs "C:\TEST.DOC"
appWord.ActiveDocument.Close
appWord.Quit
Set appWord = Nothing
End Sub
The following code, when executed, completely and irrevocably crashes
Microsoft Excel 2003 at the line <.Text = "^pDescription">. It worked just
find in Microsoft Excel XP. It even asks to send a report to Microsoft. Every
time. Easily reproducible. I have updated to all service packs/patches, etc.,
too.
Also, the line <Selection.Find.Replacement.ClearFormatting> gives a
"Automation error: the procedure number is out of range" error, which it
didn't do before in Excel 2003.
What the heck happened between the two versions? Now my code has completely
blown up!!! Any ideas????? Any help would be greatly appreciated, as we have
to get this program up and running for production! Thanks!!!
Public Sub Test()
Dim appWord As Word.Application
Set appWord = New Word.Application
appWord.Documents.Add
appWord.Selection.Find.ClearFormatting
appWord.Selection.Find.Replacement.ClearFormatting
With appWord.Selection.Find
.Text = "^pBREAK"
.Replacement.Text = "-----"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
appwordSelection.Find.Execute Replace:=wdReplaceAll
appWord.ActiveDocument.SaveAs "C:\TEST.DOC"
appWord.ActiveDocument.Close
appWord.Quit
Set appWord = Nothing
End Sub