+ Reply to Thread
Results 1 to 11 of 11

VBA : changing the active printer takes a looong time

  1. #1
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    VBA : changing the active printer takes a looong time

    I have a file with more than 600 sheets and I am using a macro to change the active printer : application.ActivePrinter="\\xxx on Ne01:". This single line of code may take up to 90 seconds to execute. Changing the active printer manually takes a second or two. Is there a way to speed up the changing of the active printer with vba??

    Daniel

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA : changing the active printer takes a looong time

    If you already know your printer name then a simple VBA script as below should do the job
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: VBA : changing the active printer takes a looong time

    Thank you.

    I am using application.activeprinter to change the printer. I can change the printer but it takes a long time to execute when a file with more than 600 sheets is open, it takes less then 1 second when this file is close. I have the same issue with your procedure: it takes a long time (1 to 2 minutes) to run. Changing the printer manually takes a second or two.

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA : changing the active printer takes a looong time

    The code is to set the default printer of for all your desktop applications. Usually the speed is depending on your 1) network speed and 2) number of devices are available. If you have many printers listed on your network, it could take a bit of time.

  5. #5
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: VBA : changing the active printer takes a looong time

    Understand but your procedure takes approx.10 seconds to execute but will take more than 1 minute if a file containing 600 sheets is open.

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA : changing the active printer takes a looong time

    For some reason I was under the impression that you are printing multiple files. If you are printing just a single file from a separate printer than the default, then your method will work the best. I was giving a solution thinking you are printing multiple files.

    Unfortunately, the printer object when executed does take a bit of time.

  7. #7
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: VBA : changing the active printer takes a looong time

    OK thank you

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA : changing the active printer takes a looong time

    Hello Daniel Dion,

    Try suspending workbook events and all calculations before changing the printer like this...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  9. #9
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: VBA : changing the active printer takes a looong time

    I tried suspending workbook events with the same results, non change in the execution time.
    Thank you for your suggestion.

  10. #10
    Registered User
    Join Date
    12-07-2013
    Location
    Montreal Canada
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: VBA : changing the active printer takes a looong time

    I tried it no change on th execution time.

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi !

    As it's just an Excel drawback : the more sheets, the longer …

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Linking workbooks - issue for looong time (please help!)
    By financeVP in forum Excel General
    Replies: 4
    Last Post: 04-11-2017, 08:57 AM
  2. [SOLVED] Solution to changing Default printer code when printer changes
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-28-2016, 03:12 PM
  3. [SOLVED] ExecuteExcel4Macro, active printer - prints to another printer - worked on 2007!
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-29-2015, 10:37 AM
  4. Changing the active printer
    By Mats Samson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2012, 04:41 PM
  5. Simple VBA to set Active Printer up
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2007, 09:06 AM
  6. [SOLVED] Setting the active printer
    By Boog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2006, 08:55 PM
  7. active printer
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-29-2005, 10:05 AM

Tags for this Thread

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1