+ Reply to Thread
Results 1 to 7 of 7

Coding Issues "Save Button"

  1. #1
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Post Coding Issues "Save Button"

    I've been working with some code that someone helped me piece together, but it isn't quite working. I'm sure it is a simple syntax issue, I'm hoping someone can assist me.

    I have a button on my form that is designed to automatically name and save the open document when pressed. it chooses the document name based on a cell in the worksheet and the current time and date stamp. The user must save their work periodically so to prevent new documents being saved every time they use the button, the button must do a "save as" on its first execution, and "Save" only on all subsequent uses. This is the code I have now, it currently does not save the document at all even the first time it is used:

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    07-29-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003, 2010, 2013
    Posts
    51

    Re: Coding Issues "Save Button"

    What happens when you click the button? Are you getting any errors that pop-up?

  3. #3
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Coding Issues "Save Button"

    Negative. No error messages. The button presses and nothing changes. I made a few small changes to the code trying to correct the issue, but to no avail. this is what it looks like now:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-29-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003, 2010, 2013
    Posts
    51

    Re: Coding Issues "Save Button"

    Can you remove any sensitive data and attach the workbook for further analysis?

  5. #5
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Coding Issues "Save Button"


  6. #6
    Registered User
    Join Date
    07-29-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003, 2010, 2013
    Posts
    51

    Re: Coding Issues "Save Button"

    Ok, I noticed that you have the same code in different places in Excel. You have the code above in the Sheet1 and also in Class1. When the button(s) are pressed, they will read the code located in the Sheet1.

    Second, I see a lot of different "Save" buttons. Do you want to code all of them? Or are you trying to just get the "Save & Close" button working first?

    For the Save & Close button, try adding this to your code (in Sheet1 in VBA):
    Please Login or Register  to view this content.
    Let me know if it works.

  7. #7
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Coding Issues "Save Button"

    Ok, I noticed that you have the same code in different places in Excel. You have the code above in the Sheet1 and also in Class1. When the button(s) are pressed, they will read the code located in the Sheet1.
    Thanks, yeah I was trying to figure out where exactly it went. I'm still in the process of "Crash Course VBA for Excel 101". This is good to know

    Second, I see a lot of different "Save" buttons. Do you want to code all of them? Or are you trying to just get the "Save & Close" button working first?
    You guessed it, next step is doing the same thing for every save button. If you have any suggestions on doing this the easiest way possible I'd love any feedback, thanksk

    For the Save & Close button, try adding this to your code (in Sheet1 in VBA):
    Please Login or Register  to view this content.
    Let me know if it works.
    This worked great! Thank you for your help

+ 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