|
-
February 25th, 1999, 05:18 PM
#1
Do search-and-replace with a Word-object
I use the following code (VB6.0) in an ActiveX-DLL to open a Word document, replace some text and print the document. Printing works fine, but the text is not being replaced, only selected. If I copy the code for replacing into a Word-macro this works well.
What am I missing?
Thanks,
Frank
-----
Public Sub PrintMyForm()
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
oWord.Documents.Open "c:/MyForm.doc"
With oWord.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = "John Doe"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
oWord.PrintOut
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|