+ Reply to Thread
Results 1 to 21 of 21

Can I "autosave" an excel document?

  1. #1
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Can I "autosave" an excel document?

    Is there a way that I can have an excel document "autosave"?

    Specificaly I would like: If a value in a specific cell's value is changed I would like the document to automatically save the document as the name of the value that is typed into that cell when the user closes the document.

    I'm not sure if this is possible, but it would be great if there was some way to do this.

    Thanks in advance for any help!

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Hi add this to the Thisworkbook code module
    Please Login or Register  to view this content.
    and add this to the top of a standard module (note: it does not need Sub....End Sub around it, simply put it at the top of the module)
    Please Login or Register  to view this content.
    now when changing A1 on sheet1 the workbook will be saved as that (as long as the workbook has been saved once, i.e not Book1 but saved as a name)
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    09-13-2009
    Location
    China
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Can I "autosave" an excel document?

    very good reply,learned something from your code

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Glad i could be of help

  5. #5
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Simon,

    Thank you! I have not tried this yet but I will. I just wanted to be sure to thank you for your help. I will let you know! Thanks!

  6. #6
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Um....forgive me for this. But, what do you mean by a standard module?

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Quote Originally Posted by whatsmyname View Post
    Um....forgive me for this. But, what do you mean by a standard module?
    How to add and run a Macro
    1. Copy the macro above placing the cursor to the left of the code box hold the CTRL & Left Click, then Right Click selected code and Copy.
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

  8. #8
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Thank you that works. I keep getting an error though. When I click back onto the cell to change the data again, it prompts me and says that the file already exists do I want to replace it? Is there any way to not get that message?

    After I click no on that pop up window, excel promps me with:

    A Microsoft Visual Basic window with a message that says: [Method 'Save As' of objects'_workbook' failed]

    I can either pick "END" "DEBUG" "HELP"

    What do I do wrong?

    Also, is there a way that I can get the save to seperate each file that I save to their own folders by date?

    Example: If I do 40 tickets in one day(9-14-09). When I save each file, I would like to be able to go to the folder that I am saving them and open up just a folder for that date(9-14-09). I'm not sure if that can be done. It would be great though.

    Thank you for your help!

  9. #9
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    replace this line
    Please Login or Register  to view this content.
    with this one
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Okay,

    I replaced that line of code with the one you said too. It didn't do anything, not even autosave. But, While I was doing that I noticed that I had an error. I repaired the error and replaced the code back with the original, and it works perfectly. The only thing is if I leave the cell blank then it promps me with the debug error box again.

    How about making it save to a new folder that it creates with the date of the ticket?

  11. #11
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Simon? Simon? SIMONNNNNNN!!!????. hahahaha.

    I was curious if my question on the previous post was possible and how can I do that?

    Any help would be greatly appreciated.

  12. #12
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Replace Thisworkbook.Path for something like "C:\blah\blah\" & Range("A1").value &"\" where A1 would be the filename.

  13. #13
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Does this look right?


    [ThisWorkbook.SaveAs ("C:\AllUsers\MyDocuments\" & Range("A1").Value & "\")]

    This code will sort all of the folders by date?

    A quick explanation of what I'm trying to do: I have a an excel file that is named "Work Order". When a user opens up that file the date is in a cell that automatically changes every day to the current date Then the user types into another cell the value that I would like to save the file as. But if that user does 10 of these "Work Orders" a day, then I would still like them to be saved as the value that was typed into the cell, but I would like all of the files to be automatically saved into folders seperated by date.

    I hope I explained that good.

    Thank you for your help.
    Last edited by whatsmyname; 09-16-2009 at 02:30 PM.

  14. #14
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    If anyone else out there that knows or understands what I am doing I would greatly appreciate your help also.

    Thank You!!!

  15. #15
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Do you already have all these folders in one location?

  16. #16
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    No I do not. I do have a folder that I want all of these folders to save too though.

  17. #17
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    I hope that this is possible. If anybody else can help me out with this I would greatly appreciate it.

  18. #18
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Provided your template workbook is stored in the same area (My Documents) and you have a folder for each day of the month (full name for each month) then this will work
    Please Login or Register  to view this content.
    , of course you can write code to check if the directory and folder exist and if not create one or both!

  19. #19
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Thanks Simon,

    Can you show me how to write code so the program will check for those folders and if they do not exist creat one?

    I really appreciate all your help.

  20. #20
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Can I "autosave" an excel document?

    Hmmmm, i don't mind helping but seriously, do a little research, tinker with the code and then get help to give it that final polish.

    There are plenty of examples out there for check dir and mkdir.

  21. #21
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Can I "autosave" an excel document?

    Okay, thank you Simon.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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