Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Printing / March 2004

Tip: Looking for answers? Try searching our database.

Store printer name to variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Barnes - 12 Mar 2004 01:54 GMT
Hi everybody,

I am using OLE to access Excel.  What I need to do is open the Printer
Selection dialog  and store the printer name to a variable.

I can open the dialog by using:
oExcel:Dialogs(8):Show()

if I try to use a variable to store this it just returns  .F.
cPrinter := oExcel:Dialogs(8):Show()   (Returns .F.)

Any Ideas?

TIA
Jeff
Dick Kusleika - 15 Mar 2004 16:55 GMT
Jeff

Try

cPrinter = oExcel.ActivePrinter

Signature

Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

> Hi everybody,
>
[quoted text clipped - 16 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.614 / Virus Database: 393 - Release Date: 05/03/2004
Jeff Barnes - 16 Mar 2004 03:15 GMT
Dick,

This will select the "Current" printer.  What I wanted to do was be able to
select from ALL the available printers.
Normally, I would just open the printers selection dialog from with in my
program but Excel adds "on NE##:" to the end of the printer.  This is why I
wanted to grab the printer from within Excel.

I was able to get some code that allows me to get the printer name from
within my program and have the Excel format.

Thanks anyway,

Jeff

> Jeff
>
[quoted text clipped - 22 lines]
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.614 / Virus Database: 393 - Release Date: 05/03/2004
Dick Kusleika - 16 Mar 2004 14:54 GMT
Jeff

That makes more sense, sorry about the confusion.

That dialog is only going to return True or False depending on which button
is clicked.  I don't think you can get the printer from that dialog into a
variable.

If all you're missing is the "on N01" part, you might do a google search in
the excel groups on it.  I know it's been discussed before and you might get
some good information on it.  I think whatever you find, you're going to
have to roll your own to do what you want.

Signature

Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

> Dick,
>
[quoted text clipped - 42 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.614 / Virus Database: 393 - Release Date: 05/03/2004
Jeff Barnes - 17 Mar 2004 03:19 GMT
Dick,

This is what I ended up doing: (using Clipper/Fivewin)

  cDevices := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )
  FOR X:= 1 TO MlCount( cDevices )
      cPrinter := MemoLine( cDevices,,X)
      cEntry := GetProfString( "Devices",cPrinter,",")
      cPort  := StrToken(cEntry,2,",")
      IF ! Empty(cPort)
         AADD(aDevices,TRIM(cPrinter)+" on "+TRIM(cPort))
      ENDIF
  NEXT

"aDevices" holds the aaray of printers in the Excel format.

Thanks again for your help,

Jeff

> Jeff
>
[quoted text clipped - 57 lines]
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.614 / Virus Database: 393 - Release Date: 05/03/2004

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.