+ Reply to Thread
Results 1 to 3 of 3

Run a macro before you save or print off

  1. #1
    Registered User
    Join Date
    09-27-2007
    Location
    Staten Island, NY
    MS-Off Ver
    Office 2013
    Posts
    64

    Run a macro before you save or print off

    Is there a way to have a worksheet automatically run a macro before you save or print to do a check and stop the action if there is an error?

    Example: If something is deleted that shouldn't be, it stops the save or print action and sends a message telling the user so they can fix it prior to avoid
    a problem down the road?

    Thanks!!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Run a macro before you save or print off

    Open visual basic
    select project explorer
    right click on your workbook on the left hand side
    select view code

    on the left where it shows General select workbook
    on the right select before save or before print.

    Please Login or Register  to view this content.
    At the bottom of your code if you want to stop the print or save function then enter "Cancel = True"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-27-2007
    Location
    Staten Island, NY
    MS-Off Ver
    Office 2013
    Posts
    64

    Re: Run a macro before you save or print off

    Quote Originally Posted by mehmetcik View Post
    Open visual basic
    select project explorer
    right click on your workbook on the left hand side
    select view code

    on the left where it shows General select workbook
    on the right select before save or before print.

    Please Login or Register  to view this content.
    At the bottom of your code if you want to stop the print or save function then enter "Cancel = True"

    Please Login or Register  to view this content.
    Worked like a charm!!! Thanks man!!

+ 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] Save/Print Macro
    By njb2.0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2013, 03:39 PM
  2. where can i find macro codes for various functions such print, save and save as
    By fellayaboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2011, 02:06 AM
  3. Print only visible rows and a print to or save as pdf Macro
    By rlebeausw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2011, 10:08 PM
  4. Defining Save Location in Print PDF Macro
    By omarq in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2010, 06:31 AM
  5. save as and print options macro
    By ramblin racer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-01-2007, 03:48 AM

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