Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 6 of 6

Thread: Finding the printer port

  1. #1
    Join Date
    13th September 2004
    Location
    Boston, MA
    Posts
    455

    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.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    22nd January 2004
    Location
    Colorado Springs
    Posts
    3,956
    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

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    22nd January 2004
    Location
    Colorado Springs
    Posts
    3,956
    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

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,314
    Hi ascalese,

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

    VB:
    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


  5. #5
    Join Date
    13th September 2004
    Location
    Boston, MA
    Posts
    455
    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

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    22nd January 2004
    Location
    Colorado Springs
    Posts
    3,956
    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. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Writing and Reading parallel port with vb
    By Michael Hayes in forum EXCEL HELP
    Replies: 6
    Last Post: April 29th, 2007, 11:57
  2. Send printer escape commands to a printer using VBA
    By mikeburg in forum EXCEL HELP
    Replies: 3
    Last Post: October 7th, 2005, 18:03
  3. VBA: Get prin data from printer port
    By Raydreamk in forum EXCEL HELP
    Replies: 2
    Last Post: December 2nd, 2003, 19:37

Bookmarks

Posting Permissions

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