Thread: Passwords
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Passwords

So would I. Thanks Jim <g

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Jim Thomlinson" wrote in message
...
The only thing I might add would be instead of using

If sh.Name < shWarn Then sh.Visible = False

I would be inclined to use
If sh.Name < shWarn Then sh.Visible = xlSheetVeryHidden

Which will make the sheets very hidden meaning that the user could not go
to
Format - Sheet - Unhide and make the sheets visible. The only way to
make
the sheets visible is through code...
--
HTH...

Jim Thomlinson


"Bob Phillips" wrote:

This would be what the code looks like. As I said, create a warning
worksheet with details of what has happened on it, and then add this code

Option Explicit

Private Const shWarn As String = "Warning"

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sh As Sheet1
Worksheets(shWarn).Visible = True
For Each sh In ThisWorkbook.Sheets
If sh.Name < shWarn Then sh.Visible = False
Next sh
End Sub

Private Sub Workbook_Open()
Dim sh As Sheet1
For Each sh In ThisWorkbook.Sheets
sh.Visible = True
Next sh
Worksheets(shWarn).Visible = False
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"K1KKKA" wrote in message
ups.com...
Bob,

Thanks for the reply, understand this option, but have tried a code i
thought would work for this, but not much luck, any idea what it should
look like?

Many thanks
Steve


Bob Phillips wrote:

The standard way to approach this is as follows.
- create a worksheet with a message on explaining that for this
workbook
to
run it needs macros enabled, maybe even a few screenshots
- hide all other worksheets
- add some code in the Workbook_Open event that un hides the other
sheets,
but hides that sheet.

What happens is that if they do not enable macros, they will only see
the
warning sheet, telling them how to do it. If they enable macros,it
will
startup the workbook as it should be.


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"K1KKKA" wrote in message
ps.com...
Ignore the above, have managed the code and works fine :)

But another question?

I have a macro that runs upon opening the workbook, is there a code
i
could use that if the macros are disabled, then all sheets are
hidden,
or the workbook will save/close if the disable option is chosen?


Steve