Word Automation Active Printer

I am trying to specify a printer to send a word document to. If I pass the printer name (PrinterName2) I get a printer not found error! No Printer name set and the default printer, prints fine! Any Ideas?? Code Sample IF ISCLEAR(wrdApp) THEN CREATE(wrdApp); //Gets the current (Default) printer name CurrPrinter := wrdApp.ActivePrinter; //Assign the printer (Make it default) IF PrinterName2 <> ‘’ THEN wrdApp.ActivePrinter(PrinterName2); //Open the document wrdDoc := wrdApp.Documents.Open2000(FileName2); //Print it! wrdDoc.PrintOut; //Reset the default printer IF wrdApp.ActivePrinter <> CurrPrinter THEN wrdApp.ActivePrinter(CurrPrinter); Note: I have tried wrdApp.ActivePrinter := PrinterName2;

I dont think you need the printer name but the printer ID from the printer table in navision. I think that should work.

quote:

I dont think you need the printer name but the printer ID from the printer table in navision. I think that should work.
Originally posted by janpieter - 2004 Nov 22 : 16:11:14

Tried that! I am passing into a function the document path and printer ID name from the Navision Printer table.

Anyone have any Idea’s on this one?[Duh!]

Ok, i have looked something up in one of my old VB6 projects and i found out the following: What should work is this: wrdApp.ActivePrinter := PrinterRec.Name; or wrdApp.Application.ActivePrinter := PrinterRec.Name; I compared the names in the navision printer table at what i pass in the VB6 program and they were the same. This just should work in Navision as well.