ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent someone from renaming a workbook (https://www.excelbanter.com/excel-programming/369149-prevent-someone-renaming-workbook.html)

Sethaholic[_29_]

Prevent someone from renaming a workbook
 

Hi,

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

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

Many thanks!!

--
Sethaholi
-----------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...fo&userid=2511
View this thread: http://www.excelforum.com/showthread.php?threadid=56753


Jim Thomlinson

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



Sethaholic[_30_]

Prevent someone from renaming a workbook
 

Thanks for the help and response! You are awesome.

One thing though, I like the concept of preventing someone from openin
a workbook if the workbook name has changed, but in my case, the file
are created and named in a very complex way. For example, a file nam
is created for the file depending on the date and time that it i
downloaded. So the file name could be something lik
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 t
access the workbook (which is good). However, they probably won't b
able to remember the "old" filename, so they will never be able t
access the file again. What can I do to solve this?

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

--
Sethaholi
-----------------------------------------------------------------------
Sethaholic's Profile: http://www.excelforum.com/member.php...fo&userid=2511
View this thread: http://www.excelforum.com/showthread.php?threadid=56753


NickHK

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" wrote
in message ...

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





All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com