Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Ensuring Macros Are Enabled

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Ensuring Macros Are Enabled

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Ensuring Macros Are Enabled

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Ensuring Macros Are Enabled

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
choose default macros Not Enabled / Macros Enable Setting BEEJAY Excel Programming 2 June 30th 06 01:07 PM
Ensuring Excel start macros complete before terminating karlman Excel Programming 3 February 7th 06 11:42 PM
Enabled macros raw[_13_] Excel Programming 1 December 14th 05 10:59 AM
Ensuring Macros are running ccarmock Excel Programming 2 October 1st 05 08:21 PM
Open workbook-macros enabled, opening another with macros George J Excel Programming 5 September 17th 04 02:07 PM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"