Hoe to disable a workbook?

F

Fan924

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.
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top