ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hoe to disable a workbook? (https://www.excelbanter.com/excel-programming/424941-hoe-disable-workbook.html)

Fan924

Hoe to disable a workbook?
 
What can be done to disable a workbook? I have a protected workbook
named MyBook.xls. If someone copies it to MyBook1.xls, I want the copy
to be unusable. What kind of thing can be done?

One thing I was thinking was it could ask for a password if the
filename had changed or path changed. A password he would not have.

Jacob Skaria[_2_]

Hoe to disable a workbook?
 
Hi

You can use the below code which will not allow the user to work with; even
if the worksheet is moved/copied to another workbook. Please make sure to
password protect the VBA project.

Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveWorkbook.Name & ActiveSheet.Name < "MyBook1Sheet1" Then
MsgBox "You are not authorized"
Exit Sub
End If
End Sub


"Fan924" wrote:

What can be done to disable a workbook? I have a protected workbook
named MyBook.xls. If someone copies it to MyBook1.xls, I want the copy
to be unusable. What kind of thing can be done?

One thing I was thinking was it could ask for a password if the
filename had changed or path changed. A password he would not have.



All times are GMT +1. The time now is 12:40 PM.

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