Protecting Macros (Excel2000)

E

Ed Beattie

Help!!! I'm trying to incorporate a password protected
worksheet function into a macro with little or no success.

I've have quite easily incorporated a simple 'protect'
and 'unprotect' function into my workbook, however, they
need to be password protected so that when the 'unprotect'
macros is run, the user is presented with the "unprotect
workbook" password box, which has to be completed before
the macros completes its task. Currently, a "run-time
error" is presented.

The password also need to be incorporated into
the 'protect' macros so that it is automatically reset
when it is run. I've tried doing this but the password
protection part of the "protect workbook" function is
missing when I subsequently run the macro.

Is it possible or will I have to use a manul system?
 
H

Harald Staff

If I understand you correctly:

Sub LockThem()
Sheets(1).Protect ("Eddie")
Sheets(2).Protect ("Eagle")
ThisWorkbook.Protect ("PW")
End Sub

Sub UnlockThem()
Sheets(1).Unprotect ("Eddie")
Sheets(2).Unprotect ("Eagle")
ThisWorkbook.Unprotect ("PW")
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