Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2003 Userinterfaceonly Password Protection Problem

Hi,

I have developed applications in Excel 2000. From testing these
applications in Excel 2003, it appears that the vba password protection
userinterface only switch may work only when manipulating the
activesheet. Here is simple code from a test workbook:

For the Workbook_Open event:

For Each Sh in ThisWorkbook.Worksheets
Sh.Protect "YOURPASSWORD", userinterfaceonly:=True
Next Sh

In a module:

Sub TestHide()
Thisworkbook.Worksheets("Sheet1").Rows("5:5").Hidd en=True
Thisworkbook.Worksheets("Sheet2").Rows("5:5").Hidd en=True
End Sub

This code will hide Row 5 of the respective sheets only when that sheet
is active. For a non-active sheet, the following error is displayed:
Run-time error '1004':
Unable to set the Hidden property of the Range class

Is this a known error? If so, does anyone have a more elegant
workaround then simply activating each sheet for which you would like
to manipulate with VBA code?

Thanks in advance,
Marc

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Excel 2003 Userinterfaceonly Password Protection Problem

Hi

I have test it on a 2003 machine and it is working for me


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message oups.com...
Hi,

I have developed applications in Excel 2000. From testing these
applications in Excel 2003, it appears that the vba password protection
userinterface only switch may work only when manipulating the
activesheet. Here is simple code from a test workbook:

For the Workbook_Open event:

For Each Sh in ThisWorkbook.Worksheets
Sh.Protect "YOURPASSWORD", userinterfaceonly:=True
Next Sh

In a module:

Sub TestHide()
Thisworkbook.Worksheets("Sheet1").Rows("5:5").Hidd en=True
Thisworkbook.Worksheets("Sheet2").Rows("5:5").Hidd en=True
End Sub

This code will hide Row 5 of the respective sheets only when that sheet
is active. For a non-active sheet, the following error is displayed:
Run-time error '1004':
Unable to set the Hidden property of the Range class

Is this a known error? If so, does anyone have a more elegant
workaround then simply activating each sheet for which you would like
to manipulate with VBA code?

Thanks in advance,
Marc



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
password protection problem dpov Excel Discussion (Misc queries) 2 August 19th 09 10:22 PM
UserInterfaceOnly & Password Protection D.Parker Excel Discussion (Misc queries) 6 October 9th 07 09:46 PM
Password Protection Problem Duncan, UK Excel Discussion (Misc queries) 0 September 14th 06 03:53 PM
question about worksheet protection using userinterfaceonly:=true David Brisco Excel Programming 0 February 9th 04 09:25 PM
Protection UserInterfaceOnly reading Hidden Formulas Rik Ditter Excel Programming 1 July 12th 03 12:50 PM


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