+ Reply to Thread
Results 1 to 9 of 9

When Saving if I need to cancel it still saves regardless of what I do

  1. #1
    Registered User
    Join Date
    07-08-2019
    Location
    Nebraska
    MS-Off Ver
    16
    Posts
    8

    When Saving if I need to cancel it still saves regardless of what I do

    Ok so I need to save in two different formats (.xlsm and .pdf) to one area which I have figured out. However, if I need to cancel or exit out it still saves. Is there a way to fix this?
    I'm new to VBA so not the most versed in it, sorry if the code is crap, it does work for what I need except the cancel part; whenever I hit cancel or try to exit out it still saves it anyways. Using excel 16 version.

    Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by sbobster15; 07-09-2019 at 09:46 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Click on Edit to open your post, 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

    (Note: this change is not optional. As you are new I will do it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-08-2019
    Location
    Nebraska
    MS-Off Ver
    16
    Posts
    8

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Thank you for that I didn't see/know that.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: When Saving if I need to cancel it still saves regardless of what I do

    In that case, please familiarise yourself with our rules (which are pretty simple): https://www.excelforum.com/forum-rul...rum-rules.html

    Thanks.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Hi sbobster15,

    Give this a try:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  6. #6
    Registered User
    Join Date
    07-08-2019
    Location
    Nebraska
    MS-Off Ver
    16
    Posts
    8

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Rules read and understood! Thanks!

  7. #7
    Registered User
    Join Date
    07-08-2019
    Location
    Nebraska
    MS-Off Ver
    16
    Posts
    8

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Arkadi That almost did it! However when I save the PDF works as it should but, I am unable to view the other file. I should have specified, I am sorry, that I need the second save to remain a .xlsm file.
    Thanks it's already been a huge help to see what I've needed to change so far.
    Last edited by sbobster15; 07-09-2019 at 10:30 AM.

  8. #8
    Registered User
    Join Date
    07-08-2019
    Location
    Nebraska
    MS-Off Ver
    16
    Posts
    8

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Arkadi - Thank you so much for pointing me in the right direction I was able to fix it with just one minor tweak. Huge time saver. THANKS AGAIN!

    here's the code that worked. It might be redundant throwing in that file format after the filename but seems to work now.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: When Saving if I need to cancel it still saves regardless of what I do

    Well done

    Yes I guess I overlooked the file extension... but then not having the file I could not test fully (I thought maybe H5 had that as part of the data). Glad you were able to fix it on your own, and thanks for posting the completed code which may help others.

    Appreciate the feedback, the rep, and taking the time to mark the thread as solved... Thank You!

+ 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] Default Filepath for Save As / Loop saving as 'FALSE' on cancel
    By ra2019 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2019, 08:42 AM
  2. VBA Disable Cancel button on Saving dialogue
    By Neilesh Kumar in forum Excel General
    Replies: 2
    Last Post: 12-01-2017, 09:59 AM
  3. Replies: 1
    Last Post: 11-13-2017, 01:36 AM
  4. [SOLVED] Code require to cancel file saving
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2014, 11:37 PM
  5. [SOLVED] How to enable user to click "cancel" if file name exists when saving as...
    By TBO in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2014, 02:22 PM
  6. Replies: 1
    Last Post: 07-12-2012, 11:00 PM
  7. [SOLVED] Disabling 'Cancel' option when saving work (Yes/No/Cancel)
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2006, 04:35 PM

Tags for this Thread

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