I’m using VFP7 with Windows 2000 with Terminal Server 2003. The application is a Word document retrieval system, and has a command button which allows the user to send a selected document to a user specified printer. The code involved is:
lc_printer = Getprinter()
oWord = Createobject("Word.Application")
oWord.Documents.Open(<filename>, .F., .T., .F., <password>)
oWord.Visible = .F.
oWord.activeprinter = Alltrim(lc_printer)
oWord.Options.PrintBackground = .F.
oWord.Documents(SubA).PrintOut()
This application runs fine on my desktop, but when I run it under terminal server Word throws the error “OLE IDispatch exception code 0 from Microsoft Word: 'ActivePrinter' is not a by reference property...” when I assign a value to the activeprinter property.
I’ve tried stripping any nonprintable characters out of the printer name, to no avail. I’ve also tried printing from word and selecting the same printer name that causes the error, and have no problem. What am I doing wrong here?
lc_printer = Getprinter()
oWord = Createobject("Word.Application")
oWord.Documents.Open(<filename>, .F., .T., .F., <password>)
oWord.Visible = .F.
oWord.activeprinter = Alltrim(lc_printer)
oWord.Options.PrintBackground = .F.
oWord.Documents(SubA).PrintOut()
This application runs fine on my desktop, but when I run it under terminal server Word throws the error “OLE IDispatch exception code 0 from Microsoft Word: 'ActivePrinter' is not a by reference property...” when I assign a value to the activeprinter property.
I’ve tried stripping any nonprintable characters out of the printer name, to no avail. I’ve also tried printing from word and selecting the same printer name that causes the error, and have no problem. What am I doing wrong here?