Okay, I'm confused; that happens a lot more than I usually like to admit.
According to your reply you need the workbook to be protected so that unauthorized users can't even
see it. Yet, the way you have worded your response to my second question makes it appear that anyone at all can access the macro, and thus access the document you didn't want them to see in the first place. If what I believe you are saying is what is actually happening, you really have no security at all! So, how exactly is access to the original macro determined?
In the meantime, the following should solve at least part of your problem. The first bit of code should be the first item in your module:
Code:
Private Sub RmvPS
ActiveWorkbook.Unprotect ("Valuation")
ActiveWorkSheets.Unprotect ("Valuation")
Call 'your first routine
End Sub
Then, as the last call in your module, you would use the following:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Unprotect ("Valuation")
ActiveWorkSheets.Unprotect ("Valuation")
End Sub
There is a final step that could be included that would beef up security at least a little: when the workbook is closed, set the worksheets Visible property to False.
Code:
Worksheets("Whatever").Visible = False
Worksheets("Whichever").Visible = False
You would, of course, have to set the property back to True when the workbook was opened. This way, if folks get into your workbook other than through the macro, they'll think it's just a set of blank sheets.
That's all I can think of until I know how your original macro is accessed.
----------------------------------------------------------------------------------
"A committee is a life form with six or more legs and no brain." -- L. Long