ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide sheets before macros can run (https://www.excelbanter.com/excel-programming/314712-hide-sheets-before-macros-can-run.html)

Rich[_25_]

Hide sheets before macros can run
 
My project is to secure an excel workbook for distribution to remote
agencies.
I have worked out a code for date checking, and how to close excel if
dates are reached.

I could say the project is finished at this stage, having reached my
objective but like others I can't in good conscience regard this as
'finished'. Purely because there are countless other security holes
which could be patched with macros if I could ject figure them out.

many ppl talk about forcing macros. I know now they can't literally be
forced, but we can persuade the user to use them.

Can someone please explain to me through the use of code, how to set a
dummy sheet (which I will have a message on, telling ppl to use
macros) while other sheets are hidden? And all this BEFORE macros are
given the chance to run??

Code for individually hiding sheets is relatively easy, but these are
macros. How are sheets hidden before macros are run?

JulieD

Hide sheets before macros can run
 
Hi Rich

distribute the workbook with the sheets hidden and place before close code
to ensure that the sheets are are hidden again if the person enables macros,
opens the workbook and then closes it.

Cheers
JulieD

"Rich" wrote in message
om...
My project is to secure an excel workbook for distribution to remote
agencies.
I have worked out a code for date checking, and how to close excel if
dates are reached.

I could say the project is finished at this stage, having reached my
objective but like others I can't in good conscience regard this as
'finished'. Purely because there are countless other security holes
which could be patched with macros if I could ject figure them out.

many ppl talk about forcing macros. I know now they can't literally be
forced, but we can persuade the user to use them.

Can someone please explain to me through the use of code, how to set a
dummy sheet (which I will have a message on, telling ppl to use
macros) while other sheets are hidden? And all this BEFORE macros are
given the chance to run??

Code for individually hiding sheets is relatively easy, but these are
macros. How are sheets hidden before macros are run?




Frank Kabel

Hide sheets before macros can run
 
Hi
not tested but as a starting point.
1. Create your 'dummy sheet'

2.Put the following code in your workbook module (not in a standard module):
sub workbook_open()
dim wks as worksheet
application.screenupdating=false
with me
..unprotect password:="your_password"
for each wks in .worksheets
if lcase(wks.name)<"dummy" then
..visible=true
end if
next wks
..worksheets("dummy").visible=xlsheetveryhidden
end with
application.screenupdating=true
end sub

sub workbook_beforeclose()
dim wks as worksheet
application.screenupdating=false
with me
..worksheets("dummy").visible=true
for each wks in .worksheets
if lcase(wks.name)<"dummy" then
..visible=xlsheetveryhidden
end if
next wks
..protect password:="your_password"
..save
end with
application.screenupdating=true
end sub




"Rich" wrote:

My project is to secure an excel workbook for distribution to remote
agencies.
I have worked out a code for date checking, and how to close excel if
dates are reached.

I could say the project is finished at this stage, having reached my
objective but like others I can't in good conscience regard this as
'finished'. Purely because there are countless other security holes
which could be patched with macros if I could ject figure them out.

many ppl talk about forcing macros. I know now they can't literally be
forced, but we can persuade the user to use them.

Can someone please explain to me through the use of code, how to set a
dummy sheet (which I will have a message on, telling ppl to use
macros) while other sheets are hidden? And all this BEFORE macros are
given the chance to run??

Code for individually hiding sheets is relatively easy, but these are
macros. How are sheets hidden before macros are run?


Tom Ogilvy

Hide sheets before macros can run
 
do a search of this newsgroup in Google groups. There are plenty of
approaches to this.

http://groups.google.com/groups?as_q...ng&lr=&hl=e n


or
http://groups.google.com/advanced_group_search?hl=en

search for force macro enable
group microsoft.public.excel.programming

--
Regards,
Tom Ogilvy

"Rich" wrote in message
om...
My project is to secure an excel workbook for distribution to remote
agencies.
I have worked out a code for date checking, and how to close excel if
dates are reached.

I could say the project is finished at this stage, having reached my
objective but like others I can't in good conscience regard this as
'finished'. Purely because there are countless other security holes
which could be patched with macros if I could ject figure them out.

many ppl talk about forcing macros. I know now they can't literally be
forced, but we can persuade the user to use them.

Can someone please explain to me through the use of code, how to set a
dummy sheet (which I will have a message on, telling ppl to use
macros) while other sheets are hidden? And all this BEFORE macros are
given the chance to run??

Code for individually hiding sheets is relatively easy, but these are
macros. How are sheets hidden before macros are run?





All times are GMT +1. The time now is 04:14 PM.

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