Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    simple "print" and "save" macros

    I want to add buttons in my document for "print" and "save" (I found a "save as" macro that works, but can't find these).

  2. #2
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    New York, New York, USA
    Posts
    266
    Thanks
    0
    Thanked 19 Times in 19 Posts
    Dear Chasersud:

    Welcome tto the Lounge.

    Before you begin, Excel 2003 on the standard toolbar already has the buttons "Save" and "Print". The "Print" on the toolbar is limited to printing only the active worksheet or grouped worksheets selected by the User and the Range inputed in the print dialog tab.

    The "Save" macro will need for some planning especially if the worrkbook will be used by multiple persons. I would say more often than not the "Save" macro would fail unless the Drive and file path were exact for both users.

    Also for printing tasks and mutliple views have you considered "custom views" for the workbook? A simple suggestion is to create the customs views you desire and then record a simple macro where you select the views and worksheets for the print job and attach that Macro to a "Print" button on the worksheet. This way Excel is doing the complex and the Macro is doing the repetitive.

    If you still wish to have a "Save" macro, can you please provide the version of Excel you are using and state if the workbook will be soley used by you, or by multiple users, that way someone in the "Lounge" could better assist.

    Regards,

    DuthieT

  3. #3
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Try this for save.
    Code:
    Sub SaveMe()
           If Not ActiveWorkbook.Saved And _
               Not ActiveWorkbook.ReadOnly Then
              ActiveWorkbook.Save
            End If
    End Sub          '*** SaveMe **
    Try this for print.
    Code:
    '                         +---------------------+                 +----------+
     '-------------------------|     PrintData()     |-----------------| 04/09/04 |
     '                         +---------------------+                 +----------+
      'Calls    : SetUpPage
    
     Sub PrintData()
         
          SetUpPage    '*** Sub Routine to setup print parameters or do it inline here ***
          ActiveWindow.SelectedSheets.PrintOut Copies:=1  'Print It!
          ActiveSheet.PageSetup.PrintArea = ""            'Clear Print Area
         
     End Sub                   'PrintData()
    Last edited by RetiredGeek; 2011-11-08 at 12:28.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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