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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Word document to selected printer 1

Status
Not open for further replies.

Freemo

MIS
Oct 25, 2005
71
GB
Hello

I have made a program which when clicked on a option, will print the active word document to that selected printer. The problem is that it works fine on a terminal but won't work on the server. It does change the default printer to the one selected, but won't print out. Below is the code i am using:

Reference to: Microsoft Word 10.0 Object Library

Dim WdApp As Word.Application

On Error Resume Next

SetDefaultPrinter "\\LXXP13\Samsung ML-7050 Series PCL5e (Copy 1)"

Set WdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
Set WdApp = CreateObject("Word.Application")
End If

WdApp.ActiveDocument.PrintOut
WdApp.ActiveDocument.Close (yes)
Set WdApp = Nothing


And in a module i have:

Public Declare Function SetDefaultPrinter Lib "winspool.drv" Alias "SetDefaultPrinterA" (ByVal PrinterName As String) As Boolean

Thanx for you help.
 
Also, i don't know if the MS Word version, has any effect on it. But my computer has MS Word 2002, which works fine. But the server has MS Word 2000.
 
You just answered yourself. Microsoft Office is downward compatible not upward. You would have to save your word document as a word 2000 document and use that version on your server.

Cathy
 
Ok Thank You MzKitty, it was to do with the references i set to the program, i was MS Word 10.0 object library, but with your suggestion, i downgraded it to MS Word 8.0 Object library and it worked. But now facing a new challenge, i am getting:

Run-time error '53':
File Not Found: Winspool.drv

This is happening on some computers but fine on others, not to sure what this is all about as the file is in the system32 & system directory of windows.

Any suggestions please.

Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top