Announcement

Collapse
No announcement yet.

Finding the printer port

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Finding the printer port

    I have searched high and low for this...help!

    I have a macro that prints to Adobe Distiller from excel and then converts to PDF. My problem is Distiller is not the default printer. The macro changes the default to Adobe Distiller but that line of code is fixed.

    Application.ActivePrinter = "Acrobat Distiller on Ne04:"

    At the end of running, the macro reassigns the default printer.

    The problem occurs when another user tries to run the macro. Is there any way to have the code determine the port of Distiller automatically? All the code I have found does not seem to do what I need it to do.

    Tony

  • #2
    Why not get the name of the current printer prior to changing the default printer.

    strActivePrinter = Application.ActivePrinter


    then before the macro ends reassign the active printer to the saved value


    Application.ActivePrinter = strActivePrinter



    Regards,
    Barry
    Regards,
    Barry

    My Favorite New Thing:
    Dynamic Named Ranges



    The alternative for
    "Press Any Key To Continue."

    and we all have one we'd like to use it on

    1. Cross Posting Etiquette
    2. Are You Here To Learn: What Have You Tried?
    3. Your Best Resource to begin learning VBA: RECORD A MACRO . . . Then Study It!

    Comment


    • #3
      I do have an API based function that I'll share that you could insert that may help. However, it's hard to explain and you may have to do some modification to use it.

      So my suggestion is to try the above first and if you're not successful I'll post a sample workbook.


      Regards,
      Barry
      Regards,
      Barry

      My Favorite New Thing:
      Dynamic Named Ranges



      The alternative for
      "Press Any Key To Continue."

      and we all have one we'd like to use it on

      1. Cross Posting Etiquette
      2. Are You Here To Learn: What Have You Tried?
      3. Your Best Resource to begin learning VBA: RECORD A MACRO . . . Then Study It!

      Comment


      • #4
        Hi ascalese,

        You could get the user to select the appropriate printer via this built-in dialog,

        Code:
        if Application.Dialogs(xlDialogPrinterSetup).Show then
            msgbox "Active printer is now " & application.activeprinter
        end if
        Or have a look at this article, which gets the name of the printers on the system. Maybe you can use the printername and search for the word Distiller

        Enumerating Local and Network Printers
        http://support.microsoft.com/?ID=166008

        For both you can incorporate Barry's suggestion of getting the current active printer and storing the name for resetting when finished.

        Cheers
        Andy

        Comment


        • #5
          Barry,

          The API function would be great. The goal is to have the user be able to click a button and the process run. No interaction from the user. Since the user could run from any location, we need to be able to reference the Distiller on any port.

          Thanks!
          Tony
          Tony

          Comment


          • #6
            Tony,


            Here is an example of how I use the API function to get a list of all the printers currently available to the PC.


            You'll be able to use the basis to be able to search for the correct printer and make it the active printer without user intervention.


            Good Luck,
            Barry
            Attached Files
            Regards,
            Barry

            My Favorite New Thing:
            Dynamic Named Ranges



            The alternative for
            "Press Any Key To Continue."

            and we all have one we'd like to use it on

            1. Cross Posting Etiquette
            2. Are You Here To Learn: What Have You Tried?
            3. Your Best Resource to begin learning VBA: RECORD A MACRO . . . Then Study It!

            Comment

            Working...
            X