outline with protection

  • Thread starter BNT1 via OfficeKB.com
  • Start date
B

BNT1 via OfficeKB.com

Hi

I'm not up with these macro's, but do used some off this forum with plenty of
help !

I have spreadsheet with 12 sheets all protected and all with outlines
(grouping) already formated

I am trying to use this macro from Dave Paterson's tread. I have amended the
password and have paste it in "This Workbook"

What I am trying to do, is when the workbook is opened by the operator, they
will be permitted to use the grouping already set up, but still have the
sheet protected. I do have more than one sheet, therefroe will i need to
amend "sheet1" on the first line?

Help appriciated

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="template", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
End Sub

Using XL 2003

Regards

Brian
 
K

Kevin B

See if the following does the trick, but save your real file under a new name
before running as this has not been tested:

Sub auto_open()

Dim wb as Workbook
Dim ws as Worksheet

Set wb = ThisWorkbook

For each ws in wb.Worksheets
With ws
.Protect Password:="template", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
Next ws

Set wb = Nothing
End Sub
 
B

BNT1 via OfficeKB.com

Thanks Kevin for the response

Copied into "this workbook". Saved, and the opened, but did not work.

Any ideas?

regards

Kevin said:
See if the following does the trick, but save your real file under a new name
before running as this has not been tested:

Sub auto_open()

Dim wb as Workbook
Dim ws as Worksheet

Set wb = ThisWorkbook

For each ws in wb.Worksheets
With ws
.Protect Password:="template", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
Next ws

Set wb = Nothing
End Sub
[quoted text clipped - 28 lines]
 
B

BNT1 via OfficeKB.com

Sorry Kevin

This works perfect, I have placed it in a module (if thats the jargon) and it
worked on all sheets

Thanks for your help

Brian
Thanks Kevin for the response

Copied into "this workbook". Saved, and the opened, but did not work.

Any ideas?

regards
See if the following does the trick, but save your real file under a new name
before running as this has not been tested:
[quoted text clipped - 22 lines]
 
G

Gord Dibben

Auto_open goes in a general module

Workbook_open would go in Thisworkbook


Gord Dibben MS Excel MVP

Thanks Kevin for the response

Copied into "this workbook". Saved, and the opened, but did not work.

Any ideas?

regards

Kevin said:
See if the following does the trick, but save your real file under a new name
before running as this has not been tested:

Sub auto_open()

Dim wb as Workbook
Dim ws as Worksheet

Set wb = ThisWorkbook

For each ws in wb.Worksheets
With ws
.Protect Password:="template", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
Next ws

Set wb = Nothing
End Sub
[quoted text clipped - 28 lines]
 
Top