+ Reply to Thread
Results 1 to 4 of 4

Macro that forces user to save file on open

  1. #1
    Registered User
    Join Date
    01-13-2009
    Location
    Berkley Heights, NJ
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Macro that forces user to save file on open

    I need to crate a macro that will force the user to save the file as a different name when they open the file
    I have this code and it works. I just need to have it run when the file is opened. Is there an on open function that I can add to make it do this?

    Sub FS()
    'fileSaveName = Application.GetSaveAsFilename(fileFilter:="Excel Files (*.xls), *.xls")
    fileSavename = Application.GetSaveAsFilename( _
    fileFilter:="Excel Files (*.xls), *.xls")
    'If user specified file name, perform Save and display msgbox

    If fileSavename <> False Then
    pointPos = InStrRev(fileSavename, ".")
    fileSavename = Left(fileSavename, pointPos - 1) & Mid(fileSavename, pointPos)
    ActiveWorkbook.SaveAs Filename:=fileSavename, FileFormat:=xlNormal

    MsgBox "Save As " & fileSavename
    End If

    End Sub

    Thanks a bunch.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Macro that forces user to save file on open

    you can use the open procudure. " put this is ths workbook section"

    Please Login or Register  to view this content.
    Aternalty to force the user to save to a directory of your choosing can be done like.
    Please Login or Register  to view this content.
    hope that helps.

  3. #3
    Registered User
    Join Date
    08-16-2009
    Location
    Fort Smith, AR
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Macro that forces user to save file on open

    So if you paste your code in the workbook_Open module it will run everytime the book is opened.

    This is found in a section above the macro modules called 'ThisWorkbook' From there paste this in and it should work fine.


    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro that forces user to save file on open

    dmars, please take a few minutes to read the forum rules, and then edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

+ 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