Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remote server error

Status
Not open for further replies.

abig99

Programmer
Oct 22, 2001
53
GB
whilst trying to open a word document through access 2000 and print it, after printing once the code stops working, giving a message about the server not being connected, on debug, the file string I am openning is selected. Believing the file to remain open after the application.quit i have closed the file within my code, I am still getting the same error though.

'Open Word Document and Print
Dim wrd As Object
Set wrd = CreateObject("Word.Application")
wrd.Visible = True
Documents.Open "C:\Documents and Settings\h\My Documents\16uplabelmaster"
Documents.Application.PrintOut
MsgBox "Click When Labels Have Printed", vbOKOnly
Documents.Close
Set wrd = Nothing
wrd.Application.Quit

Close
Exit Sub

I would appreciate any help
 
You should use the Word object you have created on ALL the relevant lines e.g.
Documents.Open "C:\Documents and Settings\h\My Documents\16uplabelmaster"

should be

wrd.Documents.Open "C:\Documents and Settings\h\My Documents\16uplabelmaster"

etc...

I think what is happening is the 'wrd' object is not being used to open the document at all!! so quiting it will not affect the status of the document.

HTH

M :)
 
Thank you mossoft, that did the trick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top