Solved

Word 2007 VBA - Error 462 Remote Server Machine Does Not Exist???

Posted on 2010-09-08
4
936 Views
Last Modified: 2013-11-27
I am using Access 2007 to create and populate a word doc.  It works great if I use this code:
objDoc.Application.Selection.TypeParagraph
Set objTable = objDoc.Tables.Add(objDoc.Application.Selection.Range, i + 1, 2)
'Setup Table properties
With objTable
    .AllowAutoFit = True
    .AutoFitBehavior wdAutoFitContent
    .BottomPadding = 0
    .TopPadding = 0
    .Rows.SetHeight 13, wdRowHeightExactly
    .Range.Font.Bold = False
End With

But as soon as I add the .Columns(2).PreferredWidth = InchesToPoints(2) as shown below, I get an error 462 - Remote Server Machine Does Not Exist??? Any thoughts would be appreciated!
objDoc.Application.Selection.TypeParagraph
Set objTable = objDoc.Tables.Add(objDoc.Application.Selection.Range, i + 1, 2)
'Setup Table properties
With objTable
    .AllowAutoFit = True
    .AutoFitBehavior wdAutoFitContent
    .BottomPadding = 0
    .TopPadding = 0
    .Rows.SetHeight 13, wdRowHeightExactly
    .Range.Font.Bold = False
    .Columns(2).PreferredWidth = InchesToPoints(2)
End With
0
Comment
Question by:CFrasnelly
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
pteranodon72 earned 500 total points
ID: 33631899
CFrasnelly,


InchesToPoints is a function within Word, Publisher, and Excel, but not Access. Try

.Columns(2).PreferredWidth = objDoc.Application.InchesToPoints(2)

and see if that resolves it.

HTH, pT72
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33632130
From the help - Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single

So could you not specify points? or create your own inchestopoints method
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33632144
eg simple with no validation

Public Function InchesToPoints(inches As Single) As Single
    InchesToPoints = inches * 72
End Function
0
 

Author Closing Comment

by:CFrasnelly
ID: 33632149
That worked! No wonder you're a master! :-)

Thanks again!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question