Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Apr 2001
    Thanked 0 Times in 0 Posts

    Determining Default Printer with VBA

    I need to sent print to the default printer of a workstation--there could be more than one printer defined. All of the defined printers would be network printers, not connected to LPT1 or LPT2.

    How would I determine which printer is the default then how would I adapt the either of the following statements:

    shell " /c copy vstring.txt lpt1:"
    Open LPT1 for output as #1

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Hollywood (sorta), California, USA
    Thanked 0 Times in 0 Posts

    Re: Determining Default Printer with VBA

    If you can use the active printer instead, this will work. If not, you may need to research the Printdialog API or the registry in order to get the default printer

    <pre> Dim strName As String
    strName = Application.ActivePrinter
    'this assumes your printer names DO NOT have spaces in them
    strName = Left$(strName, InStr(strName, " ") - 1)
    Open strName For Output Access Write As #1
    Print #1, "hiaskldjflaskjdflkasjdflkasjdflkasdjflkadjsf"
    Close #1


    Kevin <IMG SRC= alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts