>Hi,
>
>If I select a printer using getprinter() and then try to get Excel to print to this printer:
>
>lcPrinter=getprinter()
>oExcel.ActivePrinter=lcPrinter
>
>I will sometimes get an error message (Unable to set the activePrinter property)
>I tried recording a macro in excel and found out that Excel creates a command like:
>Application.ActivePrinter="//someserver/someprinter on ne3:"
>I have no idea where the ne3: comes from, but if cut this part in the recorded macro Excel will generate itself the same error, so apparantly it is essential.
>
>Any ideas what is the problem and how to deal with this?
>
>Thanks,
>
>Auke
Auke,
Ne00: ... Ne03: etc are enumeration values read from registry. However you don't need them. ActivePrinter = getprinter() works. I really don't have an idea why not working there.
Enumprinter, getprinter etc API also doesn't return Ne0x thing. AFAIK it's only read from registry. Maybe you could reveal some registry error checking printers (duplicate enumeration ?).
BTW I never tried :
lcActivePrinter = getprinter()
.AcivePrinter = lcAtivePrinter
but :
.ActiveWorkbook.ActiveSheet.PrintOut(,,,, lcActivePrinter)
Cetin