ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro in "This Workbook" (https://www.excelbanter.com/excel-discussion-misc-queries/71071-macro-workbook.html)

Trying Hard

Macro in "This Workbook"
 
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!

--
Thank you,

Trying Hard

Anne Troy

Macro in "This Workbook"
 
Q1: See:
http://www.officearticles.com/excel/...ft_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

"Trying Hard" wrote in message
...
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!

--
Thank you,

Trying Hard




Dave Peterson

Macro in "This Workbook"
 
Debra Dalgleish shows how to clean up all the remnants of macros:
http://www.contextures.com/xlfaqMac.html#NoMacros

And I think I would have a macro named auto_open that would unprotect the
workbook, hide whatever sheets you want hidden and then reprotect the workbook.

Trying Hard wrote:

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!

--
Thank you,

Trying Hard


--

Dave Peterson


All times are GMT +1. The time now is 07:18 AM.

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