Results 1 to 4 of 4

Thread: Using Word in VB - Invalid page fault in OLE32.DLL

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    6

    Post

    I am using Microsoft Word as my reporting tool for a VB app. Everything works fine on my development PC, but on a couple of other PCs VB crashes with 'invalid page fault in OLE32.DLL'. We've installed the msot recent version of DCOM95 and that didn't make a difference.

    The code is as follows:

    Set m_wrdReport = New Word.Application
    m_wrdReport.Documents.Open (App.Path & "\Templates\Par.doc")

    .
    .
    .

    With m_wrdReport.Selection.Find
    .ClearFormatting
    .Text = sHeader
    .Execute Forward:=True
    End With

    Clipboard.Clear
    Clipboard.SetText (sData)
    m_wrdReport.Selection.Paste
    Clipboard.Clear

    When the program tries to execute the ClearFormatting method, VB crashes. What this code is doing is looking for a specific word in the document (located in the sHeader variable) and replacing it with another value (in the sData variable).

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Since VB is crashing this is a long-shot, but have you manually gone to Word, recored a macro that does what you are trying to do in your program, and then compared the code in that macro to the code in your program to see if you are missing anything?

    ------------------
    Marty

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    6

    Post

    Yes I recorded a macro in Word to do a search and replace. It didn't give me any new insights. The key question to me is why does it work on the development PC and not on other PCs? What's missing on the other PCs that I have on my dev PC? On of the PCs that it crashes on is another development PC that has VB. This is how I know it crashes on the ClearFormatting method - by tracing through the code on the dev PC that it crashes on.

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    The problem can be almost anything *if* the pc's are not mirror images of one another. I use automation to read/write to Excel and one problem I encountered was that the test machines, the user machine and my machine all had different SP levels of Excel. Oddly enough, the test machines version fell between mine and the user and they were the only ones experiencing the problem.

    Step 1 ensure that all machines are running the exact same version of Word.
    Step 2 examine the .dll's used by the different machines (feel free to curse Microsoft while doing so)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width