|
-
Nov 22nd, 1999, 04:25 AM
#1
Thread Starter
New Member
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).
-
Nov 22nd, 1999, 11:49 PM
#2
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
-
Nov 22nd, 1999, 11:52 PM
#3
Thread Starter
New Member
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.
-
Nov 23rd, 1999, 01:59 AM
#4
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|