ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RunTime error 462: Remote Server not avaliable??? (https://www.excelbanter.com/excel-programming/407666-runtime-error-462-remote-server-not-avaliable.html)

Ed from AZ

RunTime error 462: Remote Server not avaliable???
 
With Excel and Word 2003, I'm using Excel VBA to automate a Word
document. Everything is going pretty much okay so far - except I keep
getting a Runtime 462 error - Remote server not available.

First, all this is on my own machine - there are no remote servers
involved.

Second, I did do some searching and found that this can crop up when
an object - like "range" - is not specifically declared as belonging
to either Word or Excel. So VB will choose, and may choose
incorrectly. So I went back and made sure everything involved here
was declared to an application.

Immediately before the error, I set a Word range and an Excel range,
and copy the Excel rnage into the Word doc as a table. That works
fine. Then I set an object to the table in Word and try to manipulate
it. That's when it errors.

If anyone can help me out. I would appreciate it.

Ed

Set wdRng = doc.Bookmarks("XL1").Range
wdRng.MoveEnd wdParagraph, 1
wdRng.Collapse wdCollapseEnd

Set rng = wks.Range("A2:H30")
rng.Copy
wdRng.InsertBefore Chr(13)
wdRng.Collapse wdCollapseEnd
wdRng.Paste

Set tbl = wdRng.Tables(1)
' NOTE: tbl is Dim'd as Word.Table

With tbl
.TopPadding = InchesToPoints(0.01) '*****
' When stepping through with F8, it errors when I get
' to the .TopPadding line
.BottomPadding = InchesToPoints(0.01)
.LeftPadding = InchesToPoints(0.02)
.RightPadding = InchesToPoints(0.02)
.Spacing = 0
.AllowPageBreaks = True
.AllowAutoFit = False
.Rows.Alignment = wdAlignRowCenter
.Rows.AllowBreakAcrossPages = False
.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter
.Rows.SpaceBetweenColumns = InchesToPoints(0.04)
.Rows.Height = wdRowHeightAuto
End With

DownThePaint

RunTime error 462: Remote Server not avaliable???
 
Hi Ed From AZ;

I don't have a direct answer for your question but a work around might be to
use linking to get the information from Word to Excel or vice versa. You can
use the Paste Link features in the Paste Specail option.

I hope it helps,



"Ed from AZ" wrote:

With Excel and Word 2003, I'm using Excel VBA to automate a Word
document. Everything is going pretty much okay so far - except I keep
getting a Runtime 462 error - Remote server not available.

First, all this is on my own machine - there are no remote servers
involved.

Second, I did do some searching and found that this can crop up when
an object - like "range" - is not specifically declared as belonging
to either Word or Excel. So VB will choose, and may choose
incorrectly. So I went back and made sure everything involved here
was declared to an application.

Immediately before the error, I set a Word range and an Excel range,
and copy the Excel rnage into the Word doc as a table. That works
fine. Then I set an object to the table in Word and try to manipulate
it. That's when it errors.

If anyone can help me out. I would appreciate it.

Ed

Set wdRng = doc.Bookmarks("XL1").Range
wdRng.MoveEnd wdParagraph, 1
wdRng.Collapse wdCollapseEnd

Set rng = wks.Range("A2:H30")
rng.Copy
wdRng.InsertBefore Chr(13)
wdRng.Collapse wdCollapseEnd
wdRng.Paste

Set tbl = wdRng.Tables(1)
' NOTE: tbl is Dim'd as Word.Table

With tbl
.TopPadding = InchesToPoints(0.01) '*****
' When stepping through with F8, it errors when I get
' to the .TopPadding line
.BottomPadding = InchesToPoints(0.01)
.LeftPadding = InchesToPoints(0.02)
.RightPadding = InchesToPoints(0.02)
.Spacing = 0
.AllowPageBreaks = True
.AllowAutoFit = False
.Rows.Alignment = wdAlignRowCenter
.Rows.AllowBreakAcrossPages = False
.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter
.Rows.SpaceBetweenColumns = InchesToPoints(0.04)
.Rows.Height = wdRowHeightAuto
End With



All times are GMT +1. The time now is 05:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com