+ Reply to Thread
Results 1 to 9 of 9

auto save when open and adding current date to file

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Shippensburg, PA
    MS-Off Ver
    office 2007, Frontpage and Visio 2003
    Posts
    22

    Question auto save when open and adding current date to file

    I am trying to idiot proof my workbook to auto save upon opening with the same file name with the current date added on the end. I have the file write protected by selecting properties and checking the box to write protect.

    I do not see a new file name being created.

    Please Login or Register  to view this content.
    Thanks in Advance,

    Christopher aka Ferrum
    Last edited by ferrum_equitis; 12-04-2012 at 01:04 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: auto save when open and adding current date to file

    Hi, Christopher,

    on opening objWorkbook should be empty. You should rely on ThisWorkbook instead
    Please Login or Register  to view this content.
    I needed to add a folder which is a Trusted location as well.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    07-30-2012
    Location
    Shippensburg, PA
    MS-Off Ver
    office 2007, Frontpage and Visio 2003
    Posts
    22

    Question Re: auto save when open and adding current date to file

    Thanks for this, I tried it, but still no new file noted.
    My workbook is not empty.
    Will that matter?

    Christopher aka Ferrum
    Last edited by ferrum_equitis; 12-03-2012 at 03:03 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: auto save when open and adding current date to file

    Hi, Christopher,

    The commands will save a copy of the workbook, no matter if there is data in it or not. Difference between SaveAs and SaveCopyAs is that the last of the two leaves you in the original workbook (save the new workbook without changing activeworkbook) while the first gets you to the newly saved workbook.

    I tried the code prior to posting and had to djust the drive and folder to suit on my system (running Windows7 and 2007).

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    07-30-2012
    Location
    Shippensburg, PA
    MS-Off Ver
    office 2007, Frontpage and Visio 2003
    Posts
    22

    Re: auto save when open and adding current date to file

    I closed everything and open up the file again, and nothing. No new file.... I am using 2007 and Win XP. I am including the file to be looked at. The code I placed at the very top.

    Thanks

    Christopher "Ferrum"
    Attached Files Attached Files

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: auto save when open and adding current date to file

    Hi, Christopher,

    the Workbook_Open-event will only get fired if placed in ThisWorkbook (currently itīs placed behind STATUSBOARD where it canīt get fired). Please relocate the code and try again.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    07-30-2012
    Location
    Shippensburg, PA
    MS-Off Ver
    office 2007, Frontpage and Visio 2003
    Posts
    22

    Question Re: auto save when open and adding current date to file

    Thanks, that did the trick. One question though... I thought it would then make the new named file with the date, the active one I was working with?

    Would that mean I would have to tell the routine to make the new one active somehow and close the 1st file?

    Thanks Again,

    Christopher aka Ferrum

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: auto save when open and adding current date to file

    Hi, Christopher,

    SaveCopyAs places a backup and leaves you in the original workbook the code started from, SaveAs will save and switch the active workbook to the newly saved workbook (no need to close the original workbook there):
    Please Login or Register  to view this content.
    Ciao,
    Holger

  9. #9
    Registered User
    Join Date
    07-30-2012
    Location
    Shippensburg, PA
    MS-Off Ver
    office 2007, Frontpage and Visio 2003
    Posts
    22

    Re: auto save when open and adding current date to file

    Thanks, that did it.

    Christopher

+ 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