W
Wolfgang Kais
Dear Newsgroup.
I have the following problem with Word/Access 2000 (Windows 2000 Pro):
(I know, these are old versions, but my customer has not yet updated)
I want to automate the process of deleting all pagebreaks in an rtf file.
From withing MS Access, I'm trying to use the following automation code:
With WObj.Documents.Open(RTF_File)
With .Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute FindText:="^m", _
Forward:=True, _
Wrap:=wdFindContinue, _
Format:=False, _
ReplaceWith:="", _
Replace:=wdReplaceAll
End With
End With
(WObj is a new instance of the Word.Application class)
The function containing this code is called from a macro in MS Access.
The ClearFormatting method produces an error that is not trappable with
usual error handling and causes the macro in MS Access to halt.
When deleting the ClearFormatting line, .Replacement.ClearFormatting
causes an error ("method not supported") that can be trapped.
When also deleting the .Replacement.ClearFormatting line, .Execute
causes a trappable automation error: "The stub contained invalid data".
When running the same code ("With ActiveDocument.Range.Find") from
within Microsoft Word (2000), everything works perfectly fine.
Running the automation code in Word/Access 2003 (Windows XP)
everything's fine, too!
Can someone please give me a hint on how to remove all pagebreaks in an
rtf file using automation from MS Access 2000 as an automation client of
MS Word 2000?
I have the following problem with Word/Access 2000 (Windows 2000 Pro):
(I know, these are old versions, but my customer has not yet updated)
I want to automate the process of deleting all pagebreaks in an rtf file.
From withing MS Access, I'm trying to use the following automation code:
With WObj.Documents.Open(RTF_File)
With .Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute FindText:="^m", _
Forward:=True, _
Wrap:=wdFindContinue, _
Format:=False, _
ReplaceWith:="", _
Replace:=wdReplaceAll
End With
End With
(WObj is a new instance of the Word.Application class)
The function containing this code is called from a macro in MS Access.
The ClearFormatting method produces an error that is not trappable with
usual error handling and causes the macro in MS Access to halt.
When deleting the ClearFormatting line, .Replacement.ClearFormatting
causes an error ("method not supported") that can be trapped.
When also deleting the .Replacement.ClearFormatting line, .Execute
causes a trappable automation error: "The stub contained invalid data".
When running the same code ("With ActiveDocument.Range.Find") from
within Microsoft Word (2000), everything works perfectly fine.
Running the automation code in Word/Access 2003 (Windows XP)
everything's fine, too!
Can someone please give me a hint on how to remove all pagebreaks in an
rtf file using automation from MS Access 2000 as an automation client of
MS Word 2000?