Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Error 462: Server not available

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex St-Pierre - 27 Oct 2006 19:11 GMT
Hi,
I execute a program from Excel that copy excel table into Word and format
the table thereafter. Sometimes (about 1 time on 3), the program stop at the
following line: .LeftIndent = CentimetersToPoints(0) (see program below)
The error message is: "Error 462": Server not available
After having an error, I can restart the macro and all works. I really don't
know what is the problem.
It seems to come with: With appWord.Selection.ParagraphFormat
The Word reference is open inside Excel (10.0) and there's no missing error.
Thanks a lot!
Alex

   Dim appWord As Word.Application
   Dim docWord2 As Word.Document
   Dim oExcel As Object 'Excel.Application
   Dim owb As Object 'Excel.Workbook
   Dim oXlRng As Object 'Excel.Range
   Dim tbl As Word.table

   On Error Resume Next
   Set appWord = GetObject(, "Word.Application")
   If appWord Is Nothing Then
       Set appWord = CreateObject("Word.Application")
   End If
   On Error GoTo 0
   Set owb = oExcel.ActiveWorkBook

   Set docWord2 = appWord.Documents.Add
   Set oXlRng = owb.Sheets("abc").Range("TableOutput")
   oXlRng.Copy
   appWord.Selection.PasteExcelTable LinkedToExcel:=False,
WordFormatting:=False, RTF:=False
   Set tbl = docWord2.Tables(1)
   docWord2.Bookmarks(1).Delete
   tbl.Select
   appWord.Activate
   With appWord.Selection.ParagraphFormat
           .LeftIndent = CentimetersToPoints(0) 'Error here
           .RightIndent = CentimetersToPoints(0)
           .SpaceBefore = 2
           .SpaceBeforeAuto = False
           .SpaceAfter = 2
           .SpaceAfterAuto = False
           .LineSpacingRule = wdLineSpaceSingle
   End With
Signature

Alex St-Pierre

Helmut Weber - 27 Oct 2006 19:51 GMT
Hi Alex,

at a very long shot I'd say,

> .LeftIndent = CentimetersToPoints(0) 'Error here
> .RightIndent = CentimetersToPoints(0)

is prone to cause errors.

Try:

.LeftIndent = 0
.RightIndent = 0

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Tony Jollans - 27 Oct 2006 22:37 GMT
The 'normal' explanation for this is disconnection of implicitly
instantiated objects. My first thought was that CentimetersToPoints was a
Word method and needed qualification but as it is also a method of Excel I
don't know. I would still be inclined to try qualifying it (either with
appWord or Application) to see if it made a difference.

--
Enjoy,
Tony

> Hi,
> I execute a program from Excel that copy excel table into Word and format
[quoted text clipped - 43 lines]
> --
> Alex St-Pierre
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.