+ Reply to Thread
Results 1 to 7 of 7

VBA code to stop printing if an Error is found

  1. #1
    Registered User
    Join Date
    11-02-2010
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2007
    Posts
    99

    VBA code to stop printing if an Error is found

    Hi Excel'ers

    I am creating a form in excel and I am trying to build an error check into the print button.

    Currently what happens now is if it finds an error (ex. someone leaves a field blank) a message box comes up to inform the user.
    But instead of stopping the print process it continues to the next statement to find more errors and then prints anyway.

    I know there is simple code to tell it to stop printing if and error is found after each if/then statement but am having trouble with the code. Could you point me in the right direction?

    JP
    Last edited by CharterJP; 11-18-2010 at 02:58 PM.

  2. #2
    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 code to stop printing if an Error is found

    Hello JP,

    Please post the code you are using.
    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!)

  3. #3
    Registered User
    Join Date
    11-02-2010
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2007
    Posts
    99

    Re: VBA code to stop printing if an Error is found

    Here it is:

    Currently I just have two of the errror statments... but there will be 5 in total and I need it to stop printing if any one of the 5 have an actual error

    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA code to stop printing if an Error is found

    Try
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    11-02-2010
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2007
    Posts
    99

    Re: VBA code to stop printing if an Error is found

    It works Great!!! Thank you

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA code to stop printing if an Error is found

    Glad we helped

  7. #7
    Registered User
    Join Date
    04-13-2015
    Location
    PARAGUAY
    MS-Off Ver
    2010
    Posts
    1

    Re: VBA code to stop printing if an Error is found

    Hi Roy! I have the same problem and canīt find the way to adapt to my project.
    Here it is:

    Please Login or Register  to view this content.

    Same as JP, when it finds an error (ex. someone leaves a field blank) a message box comes up to inform the user.
    But instead of stopping the print process (into sheet "historico") it continues to the next statement to find more errors and then prints anyway (as many times as error goes by)

    I donīt know if Iīve made myself clear, hope so =D
    Thanks!!
    Regards from Paraguay,
    Maria

+ 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