+ Reply to Thread
Results 1 to 13 of 13

VBA to open "Save As" Dialogue box whenever file is opened

  1. #1
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46

    VBA to open "Save As" Dialogue box whenever file is opened

    Hi Everyone,

    I'm wondering if there's a way to create a VBA that will automatically open a "save as" dialogue box whenever a workbook is opened. I am trying to prevent users from overwrittting old versions.

    Thanks!

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    iit'd be better to use code for workbook beforeclose event.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    The attached will auto save the file in the Documents folder. File named: Backup.xlsm

    It autosaves when the file is opened without the user being aware (ScreenUpdates and Alerts are set to False; then turned back on once the file is saved).

    Each time it autosaves the previous backup version is overwritten (replaced with the newer version).

    Code in ThisWorkBook module initiates the macro upon workbook opening to create the backup. Code in the routine module does the actual backup.


    In ThisWorkBook:

    Please Login or Register  to view this content.
    In regular Module:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    Thanks for that! However, I was hoping to write something that actually launches a "save as" dialogue box as soon as the workbook is opened so that person using it can save the new version with the updated date each time a change is made.

  5. #5
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    That's not a bad idea but I can't think of how I could do that!

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    Hello enwoznick,

    What if when the "save as" dialogue box appears and the user simply hits the cancel button?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    I misunderstood your intentions. Since you were not wanting the user to by-pass the process, made it completely automatic.

    Here's another version.
    Attached Files Attached Files

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    Some of the code in this http://www.vbaexpress.com/forum/show...-not-filled-in would apply to your situation.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  9. #9
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46
    Quote Originally Posted by Winon View Post
    Hello enwoznick,

    What if when the "save as" dialogue box appears and the user simply hits the cancel button?
    Yeah, I figured that may happen but I really just want the box to appear to prompt people to remember to save a new version right away before making changes.

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    The link I posted is the wrong one.

    Perhaps if you put this in the ThisWorkbook code module, it would do what you want.
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    This works great! Thanks so much!

    Elise

  12. #12
    Registered User
    Join Date
    04-27-2016
    Location
    Brooklyn
    MS-Off Ver
    2010
    Posts
    46

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    Quote Originally Posted by Logit View Post
    I misunderstood your intentions. Since you were not wanting the user to by-pass the process, made it completely automatic.

    Here's another version.
    Hey Logit, this has been working great. Thanks again. I'm wondering if there is a way to modify this to automatically make the "save as" name combine combine the contents of a certain cell and the date. I'm guessing this would be pretty tricky but wondering if you have any thoughts!

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA to open "Save As" Dialogue box whenever file is opened

    Using this code in the ThisWorkBook module / Close Event:

    Please Login or Register  to view this content.
    The code auto saves the file with the extension : Today's date and the time of saving (includes hours / minutes / seconds) so the file can be saved continuously without overwriting previous versions.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro needed to open "File Save As" and change save file type
    By blainerhett in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2014, 02:40 PM
  2. "File name" in "Save As" dialogue blank
    By Minor7th in forum Excel General
    Replies: 2
    Last Post: 08-23-2011, 10:31 PM
  3. how to close a file opened with "Workbooks.Open Filename:=sWb"
    By ggremel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2011, 10:37 PM
  4. Open "Save As" dialogue with "xls" as the default
    By whatsthatbeeping in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 01-18-2011, 11:19 AM
  5. Replies: 0
    Last Post: 01-04-2006, 06:55 PM
  6. Replies: 0
    Last Post: 08-17-2005, 12:05 PM
  7. [SOLVED] set up a command button or macro for open file to "save as"
    By Mo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2005, 07:19 PM
  8. [SOLVED] Office 2003 - "autocomplete" in file | open or file | save no longer works
    By Lanwench [MVP - Exchange] in forum Excel General
    Replies: 4
    Last Post: 01-11-2005, 10:06 PM

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