+ Reply to Thread
Results 1 to 5 of 5

Printing Macro- Need to auto apply to all open Excel documents

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Printing Macro- Need to auto apply to all open Excel documents

    My apologies if this thread has already been posted/solved. I'm very new to Macros. I'm using one from this forum to set printing preferences to "fit all columns one page" under portrait orientation. It works like a charm, but only for one doc at a time. Is there something I should add to below code to get it to apply to all open workbooks? I want it to apply these preferences to a number of open documents, not just the one I applied the Macro. Please let me know if you need any more information.
    I'm using Excel 2010 on Win 7
    Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Printing Macro- Need to auto apply to all open Excel documents

    Try this

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010.
    Martin

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Printing Macro- Need to auto apply to all open Excel documents

    Hi cupcakes,

    Try this:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Press ALT + F11 to open the Visual Basic Editor.

    Open a macro-enabled Workbook or save your Workbook As Macro-Enabled

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code into the white space on the right

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    01-21-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Printing Macro- Need to auto apply to all open Excel documents

    Thanks Martin and xladept! Works great!

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Printing Macro- Need to auto apply to all open Excel documents

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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