Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default cannot expand outline on protected sheet

Hi, I'm using Excel 2007. I have it outlined so I can expand and collapse it.
I've used it ok for months, expanding and collapsing it when protected, no
problem.

I'm very new to VBA. I've been adding some new code, finally got it so it
works right, but now I get this message "you cannot use this command on a
protected sheet" when I click on the expand/collapse symbols. I have no idea
what changed.

I deleted all my new code but no luck. It is not a shared spreadsheet.
I have tried ActiveSheet.EnableOutlining = True, but makes no diff.

What in the world changed?

Thanks for any ideas you may have.
Harold

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default cannot expand outline on protected sheet

This needs to be placed in a module. It will run every time the sheet is
opened

Sub Auto_Open()

Sheets("SheetName").Unprotect Password:="Yourpassword"
With Sheets("SheetName")
..Protect Password:="Yourpassword", DrawingObjects:=False, Contents:=True, _
Scenarios:= False, AllowFormattingCells:=True,
AllowFormattingColumns:=True, _ AllowFormattingRows:=True,
userinterfaceonly:=True
..EnableOutlining = True
..EnableAutoFilter = True
End With
End If

End Sub

Everything before the userinterface statement depends on the protection
options. If you are not familiar with coding the exact option, I would use
the macro recorder and unprotect and protect your sheet to get the exact
statements.

Note: the password part (Password:="Yourpassword",) will not record and
needs to be added manually.
--
If this helps, please remember to click yes.


"HGood" wrote:

Hi, I'm using Excel 2007. I have it outlined so I can expand and collapse it.
I've used it ok for months, expanding and collapsing it when protected, no
problem.

I'm very new to VBA. I've been adding some new code, finally got it so it
works right, but now I get this message "you cannot use this command on a
protected sheet" when I click on the expand/collapse symbols. I have no idea
what changed.

I deleted all my new code but no luck. It is not a shared spreadsheet.
I have tried ActiveSheet.EnableOutlining = True, but makes no diff.

What in the world changed?

Thanks for any ideas you may have.
Harold

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default cannot expand outline on protected sheet

Thanks very much Paul, this did the trick.
Out of curiosity, what suddenly changed in my spreadsheet that brought
up the error message that now requires this code to run, when it worked
fine for the past 3 months without it?

Just curious what happened?

Thanks so much,
Harold


Paul C wrote:
This needs to be placed in a module. It will run every time the sheet is
opened

Sub Auto_Open()

Sheets("SheetName").Unprotect Password:="Yourpassword"
With Sheets("SheetName")
.Protect Password:="Yourpassword", DrawingObjects:=False, Contents:=True, _
Scenarios:= False, AllowFormattingCells:=True,
AllowFormattingColumns:=True, _ AllowFormattingRows:=True,
userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
End If

End Sub

Everything before the userinterface statement depends on the protection
options. If you are not familiar with coding the exact option, I would use
the macro recorder and unprotect and protect your sheet to get the exact
statements.

Note: the password part (Password:="Yourpassword",) will not record and
needs to be added manually.

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
Group and Outline on a Protected Sheet AccessHelp Excel Discussion (Misc queries) 13 February 18th 10 04:03 PM
Capture outline expand event? Mitch Powell Excel Programming 1 November 12th 06 10:19 PM
Outline, expand or collapse via VBA Kevin McCartney Excel Programming 1 May 10th 06 04:31 PM
How can I allow an outline to be collapsed on a protected sheet? LynnAnnO Excel Worksheet Functions 0 June 8th 05 05:39 PM
Why can't I show or hide rows in an outline on a protected sheet? rwlass Excel Discussion (Misc queries) 1 December 9th 04 04:38 PM


All times are GMT +1. The time now is 03:51 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"