Macro in "This Workbook"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I actually have two questions.
I have, tried, to create a macro in "This Workbook", when I became
dissatisfied with it I simply deleted it. The problem is even though this
macro does not exist in "This Workbook" I still get a prompt (when opening)
that asks if I want to enable macro's.

Q1: How can I eliminate this?


The reason I tried to eliminate it is I recorded the macro that was supposed
to, unprotect the workbook / unhide a page, the macro is erroneous though; it
looks like this:

' Keyboard Shortcut: Ctrl+Shift+U
'
ActiveWorkbook.Unprotect
Sheets("2005 Summary, Exhaustive").Visible = True
End Sub

The macro would work perfectly if when I hit the shortcut key's it would:
unprotect the workbook / unhide a sheet named "2005 Summary, Exhaustive" /
and automatically return the protection settings back when the user closes
the file.

Q2: Can this be done, if so how?


Thanks for any help!
 
Q1: See:
http://www.officearticles.com/excel/remove_vba_code_from_a_workbook_in_microsoft_excel.htm
Q2: Sure. You'll need to create a macro that protects the workbook. Record
that. Then hit Alt+F11 and get the "guts" (delete the sub/end sub line) of
that code, and double-click the ThisWorkbook module. From the drop-downs at
top-right, choose Workbook, and Before Close, paste the guts between the sub
and end sub lines that are created.
Hit the save diskette! Also realize that your password will be stored in the
VBA code, so anyone who knows how to read it, can see it....
************
Hope it helps!
Anne Troy
www.OfficeArticles.com
Check out the NEWsgroup stats!
Check out: www.ExcelUserConference.com
 
Back
Top