Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have any of you successfuly used Chip Pearson's method for this? It is
located at http://www.cpearson.com/Excel/EnableMacros.aspx In Excel 2003 with SP3. I have tried it most recently with a blank file: I name a worksheet "Introduction" and select "xlSheetVeryHidden" for that sheet in the vba editor, paste the code in ThisWorkbook, replace the password in the code. I get a variety of errors when I save and re-open. I am indeed a novice so if you have made this work yourself, I would appreciate knowing what, if any, changes you had to make. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't know what you are doing with Chip's code but make sure the code for
Thisworkbook and General modules are in the right place. Here is a quick and dirty set of code without setting the constants and passwords as Chip does. IN Thisworkbook Module you paste this event code........................... 'If Macros are enabled this code runs when workbook opens. Private Sub Workbook_Open() UnHideAllSheets Sheets("Introduction").Visible = False End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim sht As Worksheet Application.ScreenUpdating = False Sheets("Introduction").Visible = xlSheetVisible For Each sht In ActiveWorkbook.Sheets If sht.Name < "Introduction" Then sht.Visible = xlSheetVeryHidden End If Next sht Application.ScreenUpdating = True ThisWorkbook.Save End Sub In General Module.......................... Sub UnHideAllSheets() Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count Sheets(n).Visible = True Next n Application.ScreenUpdating = True End Sub Add the code per instructions above. Save and close the workbook..................All sheets except "Introduction" will be visible. If macros are enabled when opening, all sheets will become visible and Introduction will hide. If macros are disabled, only Introduction sheet will be visible. Once you get the above working, take another look at employing Chip's code which is more secure and error trapped. Gord Dibben MS Excel MVP On Tue, 2 Nov 2010 10:34:26 -0700 (PDT), TSW632 wrote: Have any of you successfuly used Chip Pearson's method for this? It is located at http://www.cpearson.com/Excel/EnableMacros.aspx In Excel 2003 with SP3. I have tried it most recently with a blank file: I name a worksheet "Introduction" and select "xlSheetVeryHidden" for that sheet in the vba editor, paste the code in ThisWorkbook, replace the password in the code. I get a variety of errors when I save and re-open. I am indeed a novice so if you have made this work yourself, I would appreciate knowing what, if any, changes you had to make. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That worked. Thanks Gord.
On Nov 2, 2:23*pm, Gord Dibben wrote: Don't know what you are doing with Chip's code but make sure the code for Thisworkbook and General modules are in the right place. Here is a quick and dirty set of code without setting the constants and passwords as Chip does. IN Thisworkbook Module you paste this event code............................ 'If Macros are enabled this code runs when workbook opens. Private Sub Workbook_Open() UnHideAllSheets Sheets("Introduction").Visible = False End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim sht As Worksheet Application.ScreenUpdating = False * * * *Sheets("Introduction").Visible = xlSheetVisible * * * * * *For Each sht In ActiveWorkbook.Sheets * * * * * *If sht.Name < "Introduction" Then * * * sht.Visible = xlSheetVeryHidden End If Next sht Application.ScreenUpdating = True ThisWorkbook.Save End Sub In General Module.......................... Sub UnHideAllSheets() * * Application.ScreenUpdating = False * * Dim n As Single * * For n = 1 To Sheets.Count * * * * Sheets(n).Visible = True * * Next n * * Application.ScreenUpdating = True End Sub Add the code per instructions above. Save and close the workbook..................All sheets except "Introduction" will be visible. If macros are enabled when opening, all sheets will become visible and Introduction will hide. If macros are disabled, only Introduction sheet will be visible. Once you get the above working, take another look at employing Chip's code which is more secure and error trapped. Gord Dibben * * MS Excel MVP On Tue, 2 Nov 2010 10:34:26 -0700 (PDT), TSW632 wrote: Have any of you successfuly used Chip Pearson's method for this? It is located athttp://www.cpearson.com/Excel/EnableMacros.aspx In Excel 2003 with SP3. I have tried it most recently with a blank file: I name a worksheet "Introduction" and select "xlSheetVeryHidden" for that sheet in the vba editor, paste the code in ThisWorkbook, replace the password in the code. I get a variety of errors when I save and re-open. I am indeed a novice so if you have made this work yourself, I would appreciate knowing what, if any, changes you had to make. Thanks- Hide quoted text - - Show quoted text - |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good to hear.
I would suggest again looking at Chip's code which is more robust if you need that level. Gord On Tue, 2 Nov 2010 12:39:29 -0700 (PDT), TSW632 wrote: That worked. Thanks Gord. On Nov 2, 2:23*pm, Gord Dibben wrote: Don't know what you are doing with Chip's code but make sure the code for Thisworkbook and General modules are in the right place. Here is a quick and dirty set of code without setting the constants and passwords as Chip does. IN Thisworkbook Module you paste this event code........................... 'If Macros are enabled this code runs when workbook opens. Private Sub Workbook_Open() UnHideAllSheets Sheets("Introduction").Visible = False End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim sht As Worksheet Application.ScreenUpdating = False * * * *Sheets("Introduction").Visible = xlSheetVisible * * * * * *For Each sht In ActiveWorkbook.Sheets * * * * * *If sht.Name < "Introduction" Then * * * sht.Visible = xlSheetVeryHidden End If Next sht Application.ScreenUpdating = True ThisWorkbook.Save End Sub In General Module.......................... Sub UnHideAllSheets() * * Application.ScreenUpdating = False * * Dim n As Single * * For n = 1 To Sheets.Count * * * * Sheets(n).Visible = True * * Next n * * Application.ScreenUpdating = True End Sub Add the code per instructions above. Save and close the workbook..................All sheets except "Introduction" will be visible. If macros are enabled when opening, all sheets will become visible and Introduction will hide. If macros are disabled, only Introduction sheet will be visible. Once you get the above working, take another look at employing Chip's code which is more secure and error trapped. Gord Dibben * * MS Excel MVP On Tue, 2 Nov 2010 10:34:26 -0700 (PDT), TSW632 wrote: Have any of you successfuly used Chip Pearson's method for this? It is located athttp://www.cpearson.com/Excel/EnableMacros.aspx In Excel 2003 with SP3. I have tried it most recently with a blank file: I name a worksheet "Introduction" and select "xlSheetVeryHidden" for that sheet in the vba editor, paste the code in ThisWorkbook, replace the password in the code. I get a variety of errors when I save and re-open. I am indeed a novice so if you have made this work yourself, I would appreciate knowing what, if any, changes you had to make. Thanks- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
choose default macros Not Enabled / Macros Enable Setting | Excel Programming | |||
Ensuring Excel start macros complete before terminating | Excel Programming | |||
Enabled macros | Excel Programming | |||
Ensuring Macros are running | Excel Programming | |||
Open workbook-macros enabled, opening another with macros | Excel Programming |