Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Setting activeprinter property locks up Word
* the table print_jobs holds the name of a file, a destination printer name, nbr of copies
* etc.
Public go_WordApp
go_WordApp = Createobject("Word.Application")
go_WordApp.Visible = .F.
Public GV_ConfirmConversions, GV_ReadOnly, GV_AddToRecentFiles
Store .F. To GV_ConfirmConversions, GV_ReadOnly, GV_AddToRecentFiles
Local lc_filename
lc_filename = Alltrim(print_jobs.print_filename)
If File(lc_filename)
go_WordApp.Documents.Open(lc_filename, GV_ConfirmConversions, GV_ReadOnly, GV_AddToRecentFiles, g_GetPassWord(lc_filename))
If Empty(print_jobs.printer_name)
go_WordApp.activeprinter = Alltrim(gc_DefaultPrinterName)
Else
go_WordApp.activeprinter = Alltrim(print_jobs.printer_name)
Endif
Endif
I have this application installed and running in production on over 30 client sites. All computers are Windows 2000 machines and have Word 2000 installed on them. Here's the problem:
As you can see, the table print_jobs holds a list of files to be sent to the printer. As soon as the application attempts to set the activeprinter property on the Word object, the application hangs and must be killed from the task list. I've eliminated this section of code from the application, and the document prints to the default printer without a problem.
We are able to start Word, open a document, choose a printer and print interactively without a problem.
I've tried setting the instance of Word to a visible object, just to see what's going on. The document opens just fine, then everything freezes up when the activeprinter property gets changed.
I'm completely clueless on this one. Any help or suggestions on how to approach this will be appreciated.
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement