Solved

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

Posted on 2010-09-08
4
930 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
Comment Utility
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
Comment Utility
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
Comment Utility
eg simple with no validation

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

Author Closing Comment

by:CFrasnelly
Comment Utility
That worked! No wonder you're a master! :-)

Thanks again!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now