View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Hein Heinrichsen Hein Heinrichsen is offline
external usenet poster
 
Posts: 2
Default Word 2003 Find/Change Automation from Excel 2003 crashes Excel

I got it:

http://support.microsoft.com/kb/292744/EN-US/


Hein Heinrichsen wrote:

Hello
I think I have the same problem but I didnt really understand the
solution :-((. Can you please give me a hint what to change in the
code to prevent Excel from crashing?
Thank you very much!
Hein


Sub test()
Dim wrdApp As Word.Application
Dim PfadMod2 As String
Set wrdApp = New Word.Application
PfadMod2 = "H:\temp9\GesprächAnfang
März\PSS-Burghaun-Auestr-22-EifertLo"
wrdApp.ChangeFileOpenDirectory _
PfadMod2 '
wrdApp.Documents.Open Filename:="LV.dot",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
wrdApp.Visible = True
wrdApp.ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er
wrdApp.ActiveWindow.ActivePane.View.NextHeaderFoot er
wrdApp.Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext,
Name:="1"
wrdApp.Selection.Find.ClearFormatting
With wrdApp.Selection.Find
.Text = "#R#"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Selection.Find.Execute

End Sub