Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Enable groups on a protected sheet

I have a workbook which has grouping on certain sheets, i want the workbook
to protect itself everytime a user closes it. The problem i'm having is that
when the workbook is opened the sheets are protected but the user cannot
expand the groups. I have written the code below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht as Workbooksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
With Worksheets(ActiveSheet)
.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
.EnableOutlining = True

End With
Next sht
End sub

I'm sure its something simple that i'm doing wrong, can someone please help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Enable groups on a protected sheet

Somthing like the below...(I havent tested this)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Me.Worksheets
ws.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
ws.EnableOutlining = True
Next
Me.Save
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

I have a workbook which has grouping on certain sheets, i want the workbook
to protect itself everytime a user closes it. The problem i'm having is that
when the workbook is opened the sheets are protected but the user cannot
expand the groups. I have written the code below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht as Workbooksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
With Worksheets(ActiveSheet)
.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
.EnableOutlining = True

End With
Next sht
End sub

I'm sure its something simple that i'm doing wrong, can someone please help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Enable groups on a protected sheet

Hi Jacob

thanks for a quick reply

unfortunately i have the same problem, it protects each sheet but doesnt
allow the user to expand the groups



"Jacob Skaria" wrote:

Somthing like the below...(I havent tested this)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Me.Worksheets
ws.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
ws.EnableOutlining = True
Next
Me.Save
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

I have a workbook which has grouping on certain sheets, i want the workbook
to protect itself everytime a user closes it. The problem i'm having is that
when the workbook is opened the sheets are protected but the user cannot
expand the groups. I have written the code below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht as Workbooksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
With Worksheets(ActiveSheet)
.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
.EnableOutlining = True

End With
Next sht
End sub

I'm sure its something simple that i'm doing wrong, can someone please help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Enable groups on a protected sheet

Oops..I just worked on the code syntax issue...On the grouping, I dont think
you can do that with the sheet protected. We will wait for more responses
around this..

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

Hi Jacob

thanks for a quick reply

unfortunately i have the same problem, it protects each sheet but doesnt
allow the user to expand the groups



"Jacob Skaria" wrote:

Somthing like the below...(I havent tested this)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Me.Worksheets
ws.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
ws.EnableOutlining = True
Next
Me.Save
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

I have a workbook which has grouping on certain sheets, i want the workbook
to protect itself everytime a user closes it. The problem i'm having is that
when the workbook is opened the sheets are protected but the user cannot
expand the groups. I have written the code below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht as Workbooksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
With Worksheets(ActiveSheet)
.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
.EnableOutlining = True

End With
Next sht
End sub

I'm sure its something simple that i'm doing wrong, can someone please help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Enable groups on a protected sheet

Thanks for your help jacob

hopefully someone else will be able to help

"Jacob Skaria" wrote:

Oops..I just worked on the code syntax issue...On the grouping, I dont think
you can do that with the sheet protected. We will wait for more responses
around this..

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

Hi Jacob

thanks for a quick reply

unfortunately i have the same problem, it protects each sheet but doesnt
allow the user to expand the groups



"Jacob Skaria" wrote:

Somthing like the below...(I havent tested this)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Me.Worksheets
ws.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
ws.EnableOutlining = True
Next
Me.Save
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"hervinder" wrote:

I have a workbook which has grouping on certain sheets, i want the workbook
to protect itself everytime a user closes it. The problem i'm having is that
when the workbook is opened the sheets are protected but the user cannot
expand the groups. I have written the code below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht as Workbooksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
With Worksheets(ActiveSheet)
.Protect Password:="pwd", Contents:=True, UserInterfaceOnly:=True
.EnableOutlining = True

End With
Next sht
End sub

I'm sure its something simple that i'm doing wrong, can someone please help?

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
Enable hyperlinks in protected sheet Danm Setting up and Configuration of Excel 0 July 7th 08 06:47 PM
how to enable a macro in protected sheet Steve Eastham Excel Discussion (Misc queries) 2 May 4th 07 03:34 PM
Enable Auto Filters in protected sheet Tom Ogilvy Excel Programming 0 January 6th 07 08:14 PM
Enable Auto Filters in protected sheet Kari J Keinonen[_2_] Excel Programming 0 January 6th 07 08:07 PM
How to enable grouping in a protected sheet Ankur Excel Worksheet Functions 2 November 1st 04 07:52 PM


All times are GMT +1. The time now is 08:03 PM.

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

About Us

"It's about Microsoft Excel"