PDA

Click to See Complete Forum and Search --> : error loading Word 97 dll


tomtraxler
May 7th, 2005, 06:40 AM
I am trying to export some calculations to a table in a Word document. When I run the following code, it works fine in Word 2003, but I get an error message when I run it on a computer using Word 97, although my References use Word 11.0 Object Library.

The error message says that it is Runtime Error 48, Error Loading DLL.

Here is the code:
-----------------------------------------------------------------
Public Sub XYZ ()

Dim objWord as Object
Dim objDoc As Object

Set objWord = CreateObject("word.application")
Set objDoc = objWord.Documents.Add

objWord.Visible = True
objDoc.Activate

With objDoc.ActiveWindow.Selection

objDoc.Tables.Add Range:=.Range, NumRows:=26, NumColumns _
:=4
.Tables(1).AutoFormat Format:=wdTableFormatSimple1, ApplyBorders _
:=True, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, _
ApplyHeadingRows:=True, ApplyLastRow:=True, ApplyFirstColumn:=True, _
ApplyLastColumn:=False, AutoFit:=True

.SelectColumn

.Cells.SetWidth ColumnWidth:=InchesToPoints(2.5), RulerStyle:= _
wdAdjustNone
...

-----------------------------------------------------------------

The error occurs on the last line ".Cells.SetWidth ColumnWidth:=InchesToPoints(2.5), RulerStyle:= _
wdAdjustNone"

All i am trying to do is to select this first column and change its width to 2.5", but i can't get this fixed.

I sure would appreciate any help you could give me.
I am trying to export some calculations to a table in a Word document. When I run the following code, it works fine in Word 2003, but I get an error message when I run it on a computer using Word 97, although my References use Word 11.0 Object Library.

RobDog888
May 7th, 2005, 11:36 AM
Since you are Late Binding your objects you shouldnt need a Word reference. Are you leaving the reference when you compile/package
and deploy to the 97 system?

tomtraxler
May 7th, 2005, 08:18 PM
i haven't gotten so far as compiling or packaging it yet

RobDog888
May 7th, 2005, 08:58 PM
On the system with Word 97, in the VB IDE uncheck the reference to MS Word 11.0 and click ok. Then add a reference to MS Word 8.0.
Although since your using late binding all you should have to do is remove the reference to Word completely.