Peter,
Maybe you should change the printer from outside Excel using scripting.
Example
oNet = CreateObject('WScript.Network')
oNet.SetDefaultPrinter(GETPRINTER())
oExcel = CreateObject("Excel.Application")
oWorkbook = oExcel.Workbooks.Add()
oSheet = oWorkbook.WorkSheets(1)
?oExcel.ActivePrinter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Peter Hart
Sent: 16 April 2008 14:14
To: ProFox Email List
Subject: RE: Excel Automation
Hi Paul and David
When I do that on my system it doesn't give the right information i.e.
? oleExcel.ActivePrinter gives PDFCreator on NE01:
APrinters(aP,1) gives ap(1,1) "PDFCreator"
ap(1,2) "PDFCreator"
ap(1,3) "PDFCreator"
ap(1,4) "eDoc Printer"
ap(1,5) ""
ap(2,1) "HP DeskJet 1120C"
ap(2,2) "LPT1:"
ap(2,3) "HP DeskJet 1120C"
ap(2,4) ""
ap(2,5) ""
ap(3,1) "KONICA MINOLTA
mc2300DL(unidrv)"
ap(3,2) "IP_192.168.1.5"
ap(3,3) "KONICA MINOLTA
mc2300DL(unidrv)"
ap(4,4) ""
ap(4,6) ""
I have tried printing to the Minolta using
oleExcel.Application.ActivePrinter = " KONICA MINOLTA mc2300DL(unidrv)
on IP_192.168.1.5:"
but that doesn't work. Seems that FoxPro is reporting the port name you
get if you look at printer properties/ports where Excel want the Network
No.
Cheers
Peter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Crozier
Sent: 16 April 2008 13:46
To: 'ProFox Email List'
Subject: RE: Excel Automation
Peter,
APrinters() is ia two dimensional array, the second element is the port.
Also aPrinters(<<arrayname>>,1) gives you all the printer information in
an
extended array.
Dave Crozier
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
Of Peter Hart
Sent: 16 April 2008 12:37
To: ProFox Email List
Subject: RE: Excel Automation
Hi All
I am using PDFCreator to convert an Excel Spreadsheet to PDF.
I am changing the Excel active printer with the code:
oleExcel.Application.ActivePrinter = "PDFCreator on Ne01:"
And then printing the sheet with the code:
oleExcel.ActiveWindow.SelectedSheets.PrintOut(,,1,,"PDFCreator on
Ne01:",,,)
This worked OK till one of the operators added a Network printer on Ne01
so I have had to change the above code to
oleExcel.Application.ActivePrinter = "PDFCreator on Ne00:"
oleExcel.ActiveWindow.SelectedSheets.PrintOut(,,1,,"PDFCreator on
Ne00:",,,)
Question: Does anyone know of a way to find out the correct names of
the printers installed. APRINTERS() only shows "PDFCreator"
I need a way to let the operator set the full printer name of the PDF
printer so the Computer He/She is using correctly prints to the right
printer.
I.e. Pick the PDF Printer, Store its name in a Preferences Table and
then use that in the code.
TIA
Peter
Peter Hart Computers.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.