E
Edward Harford
I am opening Word Document from Access Form command button and filling word table with data
Creating Word object and filling table with data from recordset works fine on the first click. But the second time comes up with Run-time error '462' - "The remote server machine does not exist or is unavailable" at the point where I am setting table-column width see * below
Dim docWord As Word.Documen
Dim appWord As Word.Applicatio
Dim wRng As Word.Range, wTbl As Word.Tabl
Dim iRow As Integer, iRecs As Intege
Dim wArr() As wTable, T As Integer 'wTable is UDT
Set appWord = CreateObject("Word.Application.11"
Set docWord = appWord.Documents.Add(strFinalDoc
appWord.Visible = Tru
[Code that fills wArr
Set wRng = docWord.Characters.Las
wRng.Collaps
Set wTbl = docWord.Tables.Add(Range:=wRng, NumRows:=UBound(wArr) + 1, NumColumns:=2
* wTbl.Columns(1).SetWidth ColumnWidth:=InchesToPoints(1), RulerStyle:=wdAdjustNon
wTbl.Columns(2).SetWidth ColumnWidth:=InchesToPoints(5.5), RulerStyle:=wdAdjustNon
Creating Word object and filling table with data from recordset works fine on the first click. But the second time comes up with Run-time error '462' - "The remote server machine does not exist or is unavailable" at the point where I am setting table-column width see * below
Dim docWord As Word.Documen
Dim appWord As Word.Applicatio
Dim wRng As Word.Range, wTbl As Word.Tabl
Dim iRow As Integer, iRecs As Intege
Dim wArr() As wTable, T As Integer 'wTable is UDT
Set appWord = CreateObject("Word.Application.11"
Set docWord = appWord.Documents.Add(strFinalDoc
appWord.Visible = Tru
[Code that fills wArr
Set wRng = docWord.Characters.Las
wRng.Collaps
Set wTbl = docWord.Tables.Add(Range:=wRng, NumRows:=UBound(wArr) + 1, NumColumns:=2
* wTbl.Columns(1).SetWidth ColumnWidth:=InchesToPoints(1), RulerStyle:=wdAdjustNon
wTbl.Columns(2).SetWidth ColumnWidth:=InchesToPoints(5.5), RulerStyle:=wdAdjustNon