Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    what (printer) port is that? (Word 2000)

    Edited by HansV to remove <!t>[pre] / <!t>[/pre] tags from extremely long lines that caused horizontal scrolling

    Form_Load in Module 2 will list all the ports:<pre>Microsoft Document Imaging Writer Port:
    COM1: COM2: COM3: COM4: FILE: LPT1: LPT2: LPT3: BAR:</pre>

    EnumeratePrinters1 in Module 6 will list all the printers:

    There are 4 local and connected printers.
    8388608 Microsoft Office Document Image Writer,Microsoft Office Document Image Writer Driver, Microsoft Office Document Image Writer Microsoft Office Document Image Writer
    8388608 Generic / Text Only,Generic / Text Only, Generic / Text Only Generic / Text Only
    8388608 BBBHP Color LaserJet 2600n,HP Color LaserJet 2600n, BBBHP Color LaserJet 2600n BBBHP Color LaserJet 2600n
    8388608 BBBHP LaserJet 4L,HP LaserJet 4L, BBBHP LaserJet 4L BBBHP LaserJet 4L

    My little FilePrint macro will detect the printer chosen by the user:<pre>Sub FilePrint()
    With Application.Dialogs(wdDialogFilePrint)
    If .Display = -1 Then
    Debug.Print .printer
    Else
    End If
    End With
    End Sub</pre>

    I can't work out how to determine the port that is used by the printer.
    I'd like to use the printer name from the FilePrint dialog box to determine the port (I think) and allow ONLY printing to a printer port. i.e. if the printer name maps to FILE: I would dis-allow printing.
    <pre>Module Purpose
    Module 1 Get names of all local printers
    Module 2 List all available ports
    Module 3 Checks Printer? But won’t compile in Word VBA
    Module 4 Get printer driver
    Module 5 Get a list of all printers
    Module 5 Get characteristics of all printers</pre>

    In the attached document, I have placed a url to each module’s origin at the head of each module
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: what (printer) port is that? (Word 2000)

    I have attached a modified version of Module3 that will run. You can use one of your other modules to provide the printer names for the modified CheckPrinter function.

    Example:

    MsgBox CheckPrinter("Microsoft Office Document Image Writer")
    Attached Files Attached Files

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: what (printer) port is that? (Word 2000)

    Thanks Hans,
    I couldn't get your modified to work late last night, but this morning realised that the "printers" collection was adding stuff I didn't need:<pre>' Prn.Add Printer(0) & " on " & Port(0)
    Prn.Add Printer(0)</pre>

    I am now getting stuff I can use, in the sense of avoiding FILE:<pre>Microsoft Office Document Image Writer
    Printer Port Name = Microsoft Document Imaging Writer Port:

    Generic / Text Only
    Printer Port Name = FILE:

    BBBHP Color LaserJet 2600n
    Printer Port Name = USB001

    BBBHP LaserJet 4L
    Printer Port Name = LPT1:
    </pre>


  4. #4
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: what (printer) port is that? (Word 2000)

    Try Googling prnadmin

    I haven't had time to look at it myself but it seems to have a lot of functionality.

    Cheers,
    kevin

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: what (printer) port is that? (Word 2000)

    >Try Googling prnadmin
    V. much obliged, sir!

    Microsoft Told me about a registry branch with PORT data (HKLMSYSTEMCurrentControlSetControlPrint). Interesting.

    technet Told me about various scripts e.g. prnmgr.vbs.
    technet Told me more about "Inventorying the Current Printing Environment"

    The attached Module.bas, derived closely from my C:WINDOWSsystem32prnmngr.vbs seems to do the trick, sufficient, at least, for what I want.
    Look for and step through the little "TESTListPrinters"
    Attached Files Attached Files

Posting Permissions

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