PDA

View Full Version : Force users to enable macros in a workbook



jimbokentuck
09-11-2008, 03:46 PM
Hi I saw this post Force User to Enable Macros (http://www.vbaexpress.com/kb/getarticle.php?kb_id=578) and wondered if the user enables the macros is there a code that would make only a couple of worksheets visible? I have 6 including the "Welcome Page" worsheets and would only like to display 2.

thanks,
Jimbo

MaximS
09-11-2008, 04:39 PM
Why not to hide them few sheets and protect the workbook with password?

To hide sheets: Click on the tab you want to hide then go to Menu>>Format>>Sheets>>Hide.

To protect the workbook: Menu>>Tools>>Protection>>Protect Workbook

Simon Lloyd
09-11-2008, 05:15 PM
Why not to hide them few sheets and protect the workbook with password?

To hide sheets: Click on the tab you want to hide then go to Menu>>Format>>Sheets>>Hide.

To protect the workbook: Menu>>Tools>>Protection>>Protect WorkbookIt does depend on how sensitive the other sheets are, sometimes its better to hide your worksheet(s) using code, rather than just setting their visibilty to false: Worksheets("Sheet1").Visible = False which can be made visible either by code or Menu, Format, Sheets, UnHide, use: Worksheets("Sheet1").Visible = xlVeryHiddenwhich can only be reversed using code Worksheets("Sheet1").Visible = True

Slyboots
09-12-2008, 06:34 AM
Hi I saw this post Force User to Enable Macros and wondered if the user enables the macros is there a code that would make only a couple of worksheets visible? I have 6 including the "Welcome Page" worsheets and would only like to display 2.

I'd use something like this:

Sub HideSelectedWS()
For t = 1 To Sheets.Count
Sheets(t).Visible = (Sheets(t).Name = "Welcome Page" Or Sheets(t).Name = "xxx")
Next t
End Sub
S