Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Protectin/Unprotecting Sheets

Hi,

I've been using the following code to protect my sheets:

Sub protectsheet()
With ActiveSheet

.Protect Password:="topsecret", UserInterfaceOnly:=True

.EnableOutlining = True

End With

End Sub

I'd like the sheets, once they have been protected, to have the outlining
feature enabled, which holds true when I protect/unprotect the open file, but
once I close out of the file and re-open it, it tells me that I cannot use
the outlining features when it is protected. Any thoughts?

Thanks!
--
Hugo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Protectin/Unprotecting Sheets

Hi Hugo,

Untested but try enabling outlining before the protection.

.EnableOutlining = True
.Protect Password:="topsecret", UserInterfaceOnly:=True

If that does not work try a workbook open event and unprotect and re-protect.

--
Regards,

OssieMac


"Hugo" wrote:

Hi,

I've been using the following code to protect my sheets:

Sub protectsheet()
With ActiveSheet

.Protect Password:="topsecret", UserInterfaceOnly:=True

.EnableOutlining = True

End With

End Sub

I'd like the sheets, once they have been protected, to have the outlining
feature enabled, which holds true when I protect/unprotect the open file, but
once I close out of the file and re-open it, it tells me that I cannot use
the outlining features when it is protected. Any thoughts?

Thanks!
--
Hugo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Protectin/Unprotecting Sheets

Unfortunately, your suggestion yielded the same results as my previous
experience. What exactly do you mean by a workbook open event?

Any other thoughts?

Thanks!
--
Hugo


"OssieMac" wrote:

Hi Hugo,

Untested but try enabling outlining before the protection.

.EnableOutlining = True
.Protect Password:="topsecret", UserInterfaceOnly:=True

If that does not work try a workbook open event and unprotect and re-protect.

--
Regards,

OssieMac


"Hugo" wrote:

Hi,

I've been using the following code to protect my sheets:

Sub protectsheet()
With ActiveSheet

.Protect Password:="topsecret", UserInterfaceOnly:=True

.EnableOutlining = True

End With

End Sub

I'd like the sheets, once they have been protected, to have the outlining
feature enabled, which holds true when I protect/unprotect the open file, but
once I close out of the file and re-open it, it tells me that I cannot use
the outlining features when it is protected. Any thoughts?

Thanks!
--
Hugo

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Protectin/Unprotecting Sheets

Hello again Hugo,

Workbook Open Event.

When you open the VBA Editor you will see a list of the VBA modules on the
left hand side. This is called the Project Explorer. These include the sheet
modules and any modules or forms you have inserted.

Here you will see one called ThisWorkbook. Double click it and it will open
with a blank editing screen.

At the top of the editing screen there are 2 dropdown arrows.
One will have the default (General) displayed and the other the default
(Declarations).
Click the dropdown against the left one and select Workbook. It should have
created a sub heading and end sub like the following:

Private Sub Workbook_Open()

End Sub

If it did not create the required default sub/end sub like above then click
the right side dropdown and select Open and it will now be the correct
sub/end sub like the above. (If any other sub/end sub was created then it can
be deleted.)

Insert your code in there and it will run each time the workbook is opened.
(You cannot rename these subs or they will not work)

Since you were unaware of these events then perhaps you are interested in a
little lesson in events. You can try the following site. (I am sure there are
others if you search the internet for Excel events)

http://www.mvps.org/dmcritchie/excel/event.htm

--
Regards,

OssieMac


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Protectin/Unprotecting Sheets

I should have included the following:

If you can't see the Project Explorer when you open the VBA editor then Ctrl
+ r will turn it on (or menu item View - Project Explorer)

--
Regards,

OssieMac


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
Unprotecting Sheets Zee[_2_] New Users to Excel 6 November 26th 08 03:58 PM
Unprotecting Sheets with VBA and IRM Howard Excel Programming 1 August 1st 06 10:03 AM
Unprotecting Sheets Darren Excel Programming 1 May 18th 06 08:22 PM
Unprotecting Sheets with VBA and IRM Philip Excel Programming 0 December 4th 05 04:18 AM
unprotecting sheets one Excel Programming 2 April 17th 04 07:06 PM


All times are GMT +1. The time now is 08:44 AM.

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"