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 / August 2005

Tip: Looking for answers? Try searching our database.

Remote Server error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JWS315 - 23 Aug 2005 20:14 GMT
I am using the code below in Access to create a Word document, 1st time it
works fine, 2nd time I get an error that it cannot find the remote server.  I
get it on the line wdApp.ActiveDocument.PageSetup.LeftMargin =
InchesToPoints(0.5). Any suggestion will be greatly appreciated!

Jerry

Dim wdApp As Object
Dim docFinal As Object

' Create new hidden instance of Word.
  Set wdApp = CreateObject("Word.Application")
   wdApp.Visible = True
  Set docFinal = wdApp.Documents.Add
       docFinal.PageSetup.Orientation = wdOrientPortrait
       docFinal.PageSetup.DifferentFirstPageHeaderFooter = False
   docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
'Activate the current window
tmpFinalDoc = GetFileName(wdFname)
wdApp.Windows(tmpFinalDoc).Activate
       wdApp.ActiveDocument.PageSetup.LeftMargin = InchesToPoints(0.5)
       wdApp.ActiveDocument.PageSetup.RightMargin = InchesToPoints(0.5)
       wdApp.ActiveDocument.PageSetup.TopMargin = InchesToPoints(0.5)
       wdApp.ActiveDocument.PageSetup.BottomMargin = InchesToPoints(0.5)
.....
'Save the document and close
   docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
   docFinal.Close
   wdApp.Quit wdDoNotSaveChanges
   Set docFinal = Nothing
   Set wdApp = Nothing
Word Heretic - 25 Aug 2005 07:14 GMT
G'day JWS315 <JWS315@discussions.microsoft.com>,

wdApp.ActiveDocument.PageSetup is your problem

iterate through the wdApp.ActiveDocument.SECTIONS(n).PageSetup

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

JWS315 reckoned:

>wdApp.ActiveDocument.PageSetup
 
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.