+ Reply to Thread
Results 1 to 3 of 3

Generic Page Setup Macro applied to multiple workbooks with varying number of sheets

  1. #1
    Registered User
    Join Date
    10-29-2003
    Posts
    48

    Generic Page Setup Macro applied to multiple workbooks with varying number of sheets

    Sheet one of my workbook has a listing of available command buttons. I am trying to get three of those buttons to format the page setup for different print sizes. I am trying to come up with three generic macros that will work if I have 5, 6, 7, or however many worksheets.

    Macro 1: Formats all pages to print 8.5 x 11 and then prints
    Macro 2: Formats to 8.5 x 14 and then prints
    Macro 3: Formats to 11 x 17 and then prints


    Is there a generic way of writing this code so that the same macro can be applied to multiple workbooks and adapt to different sheet quantities?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    14,477
    I think that's when you would use a For Each ... Next loop. Search online VBA help for "For Each Next"

  3. #3
    Registered User
    Join Date
    10-29-2003
    Posts
    48
    Thank you for the help. This is what I came up with. One question....If the default printer is not capable of printing 11 x 17, it displays an error to the user. Is it possible for me to intercept that particular error box and display my own box, explaining what went wrong?


    Please Login or Register  to view this content.

+ 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