R
Randall
I am exchanging data between Excel and Word (as an HTML document). I insert
a new table into word and then set the column widths. Periodically I get the
following error:
Run-time error ‘462’:
The remote server machine does not exist or is unavailable.
The error only happens sometimes. In order to avoid getting this error
again, I must close Excel and Word and rerun the macro. Does anyone know why
this error sporadically appears and what I can do to avoid it? The code in
question is below.
Tx,
Randall
Set WD = CreateObject("Word.Application") 'Microsoft Word Object
WD.Visible = True
WD.Documents.Add DocumentType:=1 'Create New Web Page Document
Set MainDoc = WD.Selection
'Put in Table
MainDoc.Tables.Add Range:=MainDoc.Range, NumRows:=1, NumColumns:=3,
DefaultTableBehavior:=wdWord9TableBehavior
With MainDoc.Tables(1)
'**** The Next Line gives the error
.Columns(1).PreferredWidth = InchesToPoints(2.8)
.Columns(2).PreferredWidth = InchesToPoints(1.7)
.Columns(3).PreferredWidth = InchesToPoints(1.7)
End With
a new table into word and then set the column widths. Periodically I get the
following error:
Run-time error ‘462’:
The remote server machine does not exist or is unavailable.
The error only happens sometimes. In order to avoid getting this error
again, I must close Excel and Word and rerun the macro. Does anyone know why
this error sporadically appears and what I can do to avoid it? The code in
question is below.
Tx,
Randall
Set WD = CreateObject("Word.Application") 'Microsoft Word Object
WD.Visible = True
WD.Documents.Add DocumentType:=1 'Create New Web Page Document
Set MainDoc = WD.Selection
'Put in Table
MainDoc.Tables.Add Range:=MainDoc.Range, NumRows:=1, NumColumns:=3,
DefaultTableBehavior:=wdWord9TableBehavior
With MainDoc.Tables(1)
'**** The Next Line gives the error
.Columns(1).PreferredWidth = InchesToPoints(2.8)
.Columns(2).PreferredWidth = InchesToPoints(1.7)
.Columns(3).PreferredWidth = InchesToPoints(1.7)
End With