+ Reply to Thread
Results 1 to 7 of 7

'Save' or 'save as' Command Button VBA Excel

  1. #1
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    'Save' or 'save as' Command Button VBA Excel

    As I use my multi-page userform I would like to save periodically so I thought it a good idea to add a 'save' and a 'save as' command button to the userform. Looking online it appears the command button would be coded as such:

    Please Login or Register  to view this content.
    Would this mean the 'save as' command button would be coded as such?:

    Please Login or Register  to view this content.
    The reason I want both is the first time the user saves the form they need to save it in a different location and rename it accordingly. The rest of the times it will just be to save as data as inputed so nothing is lost.

    Thank you!

  2. #2
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: 'Save' or 'save as' Command Button VBA Excel

    I forgot to add, When I test my 'save as' option, I'm warned the file already exists and asks if I want to overwrite it. When I say no, I get the following error:

    Run-Time error '1004': Cannot access 'current name of form here'.

  3. #3
    Registered User
    Join Date
    01-03-2013
    Location
    Kerteh, Terengganu, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: 'Save' or 'save as' Command Button VBA Excel

    Have you tried:

    Please Login or Register  to view this content.
    if you press the cancel button you'll end up with a file name 'false'. Need to put in some if-then-else statement in there somewhere.

  4. #4
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: 'Save' or 'save as' Command Button VBA Excel

    Interesting.... what kind of if then else statement would take care of that?

  5. #5
    Registered User
    Join Date
    01-03-2013
    Location
    Kerteh, Terengganu, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: 'Save' or 'save as' Command Button VBA Excel

    I haven't figured that out. Will post if I do.

  6. #6
    Registered User
    Join Date
    01-01-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: 'Save' or 'save as' Command Button VBA Excel

    I'm new to VBA but how about:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: 'Save' or 'save as' Command Button VBA Excel

    I ended up using:

    Please Login or Register  to view this content.
    And, it appears to be working perfectly.

+ 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