J
Jon Petitta
I have been developing on one machine and of course when I
move to another one I get a problem. They are both Win
2000 adv server, and Office XP. The problem is with the
version of Word, the code will run when you use verion
10.4219.4219, but doesn't on 10.5522.4219. It gives me an
invalid procedure call, anyone know what is going on.
here's the code.
Dim oApp as Word.Application
Set oApp = New word.Application
oApp.Visible = True
oApp.Documents.Open ("C:\dir\file.doc")
With oApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%ClientName"
.Replacement.Text = strClientName
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteSTreet"
.Replacement.Text = strSStreet
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteCity"
.Replacement.Text = strSCity
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteState"
.Replacement.Text = strSState
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteZip"
.Replacement.Text = strSZip
.Execute Replace:=wdReplaceAll
End With
oApp.ActiveWindow.ActivePane.View = wdPrintView
oApp.ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
oApp.ActiveWindow.ActivePane.View.NextHeaderFooter
With oApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%ClientName"
.Replacement.Text = strClientName
.Execute Replace:=wdReplaceAll
End With
oApp.ActiveDocument.SaveAs ("C:\dir\otherfile.doc")
oApp.Application.Quit
If I take out the find and replace code and just do the
open and save as it works ok. I even took out the find
code and just did oApp.Selection.Find.Text = "" and gave
the same error.
Any help would be great.
Jon
move to another one I get a problem. They are both Win
2000 adv server, and Office XP. The problem is with the
version of Word, the code will run when you use verion
10.4219.4219, but doesn't on 10.5522.4219. It gives me an
invalid procedure call, anyone know what is going on.
here's the code.
Dim oApp as Word.Application
Set oApp = New word.Application
oApp.Visible = True
oApp.Documents.Open ("C:\dir\file.doc")
With oApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%ClientName"
.Replacement.Text = strClientName
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteSTreet"
.Replacement.Text = strSStreet
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteCity"
.Replacement.Text = strSCity
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteState"
.Replacement.Text = strSState
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%SiteZip"
.Replacement.Text = strSZip
.Execute Replace:=wdReplaceAll
End With
oApp.ActiveWindow.ActivePane.View = wdPrintView
oApp.ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
oApp.ActiveWindow.ActivePane.View.NextHeaderFooter
With oApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "%ClientName"
.Replacement.Text = strClientName
.Execute Replace:=wdReplaceAll
End With
oApp.ActiveDocument.SaveAs ("C:\dir\otherfile.doc")
oApp.Application.Quit
If I take out the find and replace code and just do the
open and save as it works ok. I even took out the find
code and just did oApp.Selection.Find.Text = "" and gave
the same error.
Any help would be great.
Jon