+ Reply to Thread
Results 1 to 6 of 6

Exit Sub When Cancel on InputBox

  1. #1
    Registered User
    Join Date
    05-16-2016
    Location
    Tangier
    MS-Off Ver
    MS 2013
    Posts
    14

    Exit Sub When Cancel on InputBox

    Hello everyone I have this small issue that I'm running with

    I have a macro that auto saves an excel file as PDF but i want it to stop when I press Cancel on the inputBox which is not the case

    Here's the code



    Please Login or Register  to view this content.
    Last edited by Linkonem; 11-19-2017 at 02:00 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Exit Sub When Cancel on InputBox

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Please take a few minutes to review the rules of the forum that you agreed to abide by when you joined.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-16-2016
    Location
    Tangier
    MS-Off Ver
    MS 2013
    Posts
    14

    Re: Exit Sub When Cancel on InputBox

    Everything in the code works fine All I need is cancel the execution of the code if I press cancel in the Inputbox.

    Sorry for my very beginner level into Excel VBA and this forum Rules I don't post here much

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Exit Sub When Cancel on InputBox

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    05-16-2016
    Location
    Tangier
    MS-Off Ver
    MS 2013
    Posts
    14

    Re: Exit Sub When Cancel on InputBox

    It Worked !!!!!

    Thank you so much Norie,


    Now I can move on to make my code more efficient

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Exit Sub When Cancel on InputBox

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Vba to exit sub on cancel on inputbox
    By alkiviadi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2016, 12:17 PM
  2. [SOLVED] MACRO: If user clicks cancel in inputbox,then do nothing. Problem with inputbox appearance
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2015, 04:33 AM
  3. [SOLVED] Exit Sub if Inputbox cancel, X Button or blank value is used (bypass debug)
    By liamtimms1985 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2015, 07:03 AM
  4. [SOLVED] Cancel = End Sub - how to Exit Run of Macros
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-24-2015, 06:05 PM
  5. Inputbox - formatted as Date, unable to exit sub on Cancel
    By Lewis Smeby in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2015, 05:27 PM
  6. [SOLVED] Exit Sub on InputBox Cancel
    By qwerty7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2015, 07:33 PM
  7. Exit Sub when I hit cancel
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2007, 01:27 PM

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