Using Word97 from VB6, an SP5-induced error? 
Author Message
 Using Word97 from VB6, an SP5-induced error?

To adapt a master Word97 document from within VB6, I use the
appended code (stripped).
The subroutine ReplText was created by recording a macro in Word97,
I only added the 'objDoc.ActiveWindow.'-part. While ReplText is
executed I get pagefaults in OLE32.DLL and MSVBVM60.DLL, in
that order. It runs fine if the call to ReplText is commented out.
The same program runs without any problems on another PC,
but there is one difference: on the machine causing problems
Service Pack 5 is installed, not on the other PC. I am using
Windows95 on both machines.
By the way, is there a way to undo only the SP5 installation?

Thanks
==============================================
Public objWord As Word.Application
Public objDoc As Word.Document

Private Sub cmdUitvoeren_Click()
    Dim strOldString As String, strNewString As String
    strOldString = "$ITEM1"
    strNewString = "some new value"
    Set objWord = New Word.Application
    Set objDoc = objWord.Documents.Open("C:\OldFile.doc", , False)

    ReplText strOldString, strNewString

    objDoc.SaveAs "C:\NewFile.doc"
End Sub

Private Sub ReplText(strStringOld As String, strStringNew As String)
    objDoc.ActiveWindow.Selection.Find.ClearFormatting
    objDoc.ActiveWindow.Selection.Find.Replacement.ClearFormatting
    With objDoc.ActiveWindow.Selection.Find
        .Text = strStringOld
        .Replacement.Text = strStringNew
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    objDoc.ActiveWindow.Selection.Find.Execute Replace:=wdReplaceAll
End Sub



Sat, 10 Jan 2004 21:17:27 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Once more: using Word97 from VB6, and SP5-induced error?

2. VB6 SP5 not compatible with pre SP5???

3. Automation Error with Winsock OCX on NT 4 -- compiled with VB6 (SP5)

4. error in data form wizard in VB6 SP5

5. error in data form wizard in VB6 SP5

6. error in data form wizard in VB6 SP5

7. Saving a document to SQL using VB6 (SP5)

8. Using Data Project in VB6 sp5

9. Automation Error with Winsock OCX on NT 4 -- compiled with VB6 (SP5)

10. mailmerge with word97,2000,xp using vb.net,vb6

11. mailmerge with word97,2000,xp using vb6,vb.net

12. VB6 app using Word97

 

 
Powered by phpBB® Forum Software