+ Reply to Thread
Results 1 to 8 of 8

Create a Save Button

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

    Post Create a Save Button

    I'm creating a form that users will fill out through out the day and then save each night to a certain folder with a certain name. to prevent mistakes, I wanted to automate this process as much as possible.

    I have created a save button on my form, I need it to do 3 things:

    1 - Save the workbook using the information in cell D2 as the first half of the file name. The other half should be a time / date stamp.
    An example of what I'd like the file name to look like would be:
    Kevin.73020120917.xlsm
    (D2) (date) (time)

    2 - That file needs to be saved to a specific folder: o:\bellingham\intranet\reporting\forkliftweights\

    3 - Close workbook.


    If there is any other function you would recommend including on this, I'd love any feedback as well. Would it be worth including something that checks for duplicate file names? etc.

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Create a Save Button

    Hello there,

    Try this.

    Please Login or Register  to view this content.
    You'll need to insert a command button onto your worksheet and then add the above code to it.

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

    Re: Create a Save Button

    Thanks for your response, I wonder if I did something wrong. I went into design mode, Right Clicked on my button and clicked "View Code"

    at that point I copied the following:

    Please Login or Register  to view this content.
    I saved my module and closed it and went back to test the save button and got this error:

    Compile error:

    Invalid outside procedure
    My module was automatically opened and had highlighted:

    ="o:\bellingham\intranet\reporting\forkliftweights\"

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Create a Save Button

    Sorry I forgot to add the extension at the end try this:

    Please Login or Register  to view this content.

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

    Re: Create a Save Button

    hmmm.... its still doing the same thing... Do I need an end sub or anything added onto it?

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Create a Save Button

    Can you copy and paste the entire code you have?

    It should look something like this

    Please Login or Register  to view this content.
    Make sure the filepath you provided in your first post is correct. This part:

    Please Login or Register  to view this content.


    ---------- Post added at 12:23 PM ---------- Previous post was at 12:17 PM ----------

    If your unsure what the file path should look like, go to a document that is located in the area you want the documents to be saved and open it. Then in a blank cell type

    Please Login or Register  to view this content.
    Copy and paste special the values of the cell and then copy everything before the name of the document.
    This is the filepath.

    ---------- Post added at 12:24 PM ---------- Previous post was at 12:23 PM ----------

    For instance when I save mine my filepath looks like this

    Please Login or Register  to view this content.
    so my code in the workbook looks like this

    Please Login or Register  to view this content.
    Last edited by rvasquez; 07-30-2012 at 01:20 PM.

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

    Re: Create a Save Button

    Aaah, I got it, thanks!

    I was missing the sub end sub part. My code now looks like this:
    Please Login or Register  to view this content.
    And it works great!

    Thanks for your help!

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Create a Save Button

    No problem!

+ 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