+ Reply to Thread
Results 1 to 4 of 4

Prevent someone from renaming a workbook

  1. #1
    Registered User
    Join Date
    07-11-2005
    Posts
    38

    Arrow Prevent someone from renaming a workbook

    Hi,

    I programmed a macro that disables the "save as" function so that users won't be able to "save as" and rename the workbook to something else (for security purposes).

    However, users can still rename it manually outside the workbook. Is there a way that I can program something in VBA or somewhere else to prevent users from manually renaming a workbook?

    Many thanks!!!

  2. #2
    Jim Thomlinson
    Guest

    RE: Prevent someone from renaming a workbook

    There is nothing you can do about a user renaming the file. File naming is
    handled by the operating system. You could write some code in the
    Workbook_Open event in the ThisWorkbook module that checks the file name and
    responds appropriately... something like this:

    Private Sub Workbook_Open()
    If ThisWorkbook.Name <> "Whatever.xls" Then
    MsgBox "Bad file name"
    End If
    End Sub
    --
    HTH...

    Jim Thomlinson


    "Sethaholic" wrote:

    >
    > Hi,
    >
    > I programmed a macro that disables the "save as" function so that users
    > won't be able to "save as" and rename the workbook to something else
    > (for security purposes).
    >
    > However, users can still rename it manually outside the workbook. Is
    > there a way that I can program something in VBA or somewhere else to
    > prevent users from manually renaming a workbook?
    >
    > Many thanks!!!
    >
    >
    > --
    > Sethaholic
    > ------------------------------------------------------------------------
    > Sethaholic's Profile: http://www.excelforum.com/member.php...o&userid=25113
    > View this thread: http://www.excelforum.com/showthread...hreadid=567534
    >
    >


  3. #3
    Registered User
    Join Date
    07-11-2005
    Posts
    38

    Arrow

    Thanks for the help and response! You are awesome.

    One thing though, I like the concept of preventing someone from opening a workbook if the workbook name has changed, but in my case, the files are created and named in a very complex way. For example, a file name is created for the file depending on the date and time that it is downloaded. So the file name could be something like WBBI_2006073116434. I don't want users to be able to rename the file, yet if they do rename the file manually, then they won't be able to access the workbook (which is good). However, they probably won't be able to remember the "old" filename, so they will never be able to access the file again. What can I do to solve this?

    Any advice at all would be very helpful. Thanks again!!

  4. #4
    NickHK
    Guest

    Re: Prevent someone from renaming a workbook

    If you can arrange for the WB to be saved to a folder where users do not
    have permission to do that, you can leave to the OS.
    Otherwise, when the WB is saved with it's legitimate name, store that name
    some in the WB; on a hidden sheet or may be .CustomProperty.
    Then when it's opened, you can see if it has changed and react accordingly.

    NickHK

    "Sethaholic" <Sethaholic.2bxj3v_1154550323.624@excelforum-nospam.com> wrote
    in message news:Sethaholic.2bxj3v_1154550323.624@excelforum-nospam.com...
    >
    > Thanks for the help and response! You are awesome.
    >
    > One thing though, I like the concept of preventing someone from opening
    > a workbook if the workbook name has changed, but in my case, the files
    > are created and named in a very complex way. For example, a file name
    > is created for the file depending on the date and time that it is
    > downloaded. So the file name could be something like
    > WBBI_2006073116434. I don't want users to be able to rename the file,
    > yet if they do rename the file manually, then they won't be able to
    > access the workbook (which is good). However, they probably won't be
    > able to remember the "old" filename, so they will never be able to
    > access the file again. What can I do to solve this?
    >
    > Any advice at all would be very helpful. Thanks again!!
    >
    >
    > --
    > Sethaholic
    > ------------------------------------------------------------------------
    > Sethaholic's Profile:

    http://www.excelforum.com/member.php...o&userid=25113
    > View this thread: http://www.excelforum.com/showthread...hreadid=567534
    >




+ 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