Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run Time Error 1004 Unable to set hidden property


Hi,

I'm experiencing problems with a run time error 1004 unable to set
hidden property. The problem is that the worksheet that I'm using is
protected, and on my PC, I do not get this error. But when some other
people open the file on their PC, they get this error. I'm currently
using Excel 2002 (10.2614.3501) SP-1, I don't know what version the
other users have, but on an unprotected version of this file, they do
not have this problem.

Does this problem have something to do with versioning, or settings in
Excel?

Thanks,

Lester




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run Time Error 1004 Unable to set hidden property

Thanks for the explanation Dave.

I put the code in and it protects the sheets now, but it gives me the
error with when I'm unhiding rows, and I have a lot of code that hides
and unhides rows throughout the workbook. Its there a way to put the
protection in the code and allow it to use the hidden command without
me having put a protect and unprotect code with every hidden command?

Thanks,

Lester

Dave Peterson wrote in message ...
xl2002 added a bunch more things you can do to a protected worksheet.

One of them is "format columns". xl2k (and before) didn't have this.

If you're using code, you may want to try to protect the worksheet the

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

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

(you could use the workbook_open even under ThisWorkbook, too.)

userinterfaceonly:=true allows your code to do more things than the users.

So I could do this:

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.Range("a1,e1").EntireColumn.Hidden = True
End With
End Sub



Lester Lee wrote:

Hi,

I'm experiencing problems with a run time error 1004 unable to set
hidden property. The problem is that the worksheet that I'm using is
protected, and on my PC, I do not get this error. But when some other
people open the file on their PC, they get this error. I'm currently
using Excel 2002 (10.2614.3501) SP-1, I don't know what version the
other users have, but on an unprotected version of this file, they do
not have this problem.

Does this problem have something to do with versioning, or settings in
Excel?

Thanks,

Lester

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Run Time Error 1004 Unable to set hidden property


Remarks on Protect Method in VBA help.:
If you apply the Protect method with the UserInterfaceOnly argument set
to True to a worksheet and then save the workbook, the entire worksheet
(not just the interface) will be fully protected when you reopen the
workbook. To re-enable the user interface protection after the workbook
is opened, you must again apply the Protect method with
UserInterfaceOnly set to True.
If changes wanted to be made to a protected worksheet, it is possible
to use the Protect method on a protected worksheet if the password is
supplied. Also, another method would be to unprotect the worksheet,
make the necessary changes, and then protect the worksheet again.




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Lester wrote :

Thanks for the explanation Dave.

I put the code in and it protects the sheets now, but it gives me the
error with when I'm unhiding rows, and I have a lot of code that hides
and unhides rows throughout the workbook. Its there a way to put the
protection in the code and allow it to use the hidden command without
me having put a protect and unprotect code with every hidden command?

Thanks,

Lester

Dave Peterson wrote in message
...
xl2002 added a bunch more things you can do to a protected
worksheet.

One of them is "format columns". xl2k (and before) didn't have
this.

If you're using code, you may want to try to protect the worksheet
the

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

It needs to be reset each time you open the workbook. (excel
doesn't remember it after closing the workbook.)

(you could use the workbook_open even under ThisWorkbook, too.)

userinterfaceonly:=true allows your code to do more things than the
users.

So I could do this:

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.Range("a1,e1").EntireColumn.Hidden = True
End With
End Sub



Lester Lee wrote:

Hi,

I'm experiencing problems with a run time error 1004 unable to set
hidden property. The problem is that the worksheet that I'm
using is protected, and on my PC, I do not get this error. But
when some other people open the file on their PC, they get this
error. I'm currently using Excel 2002 (10.2614.3501) SP-1, I
don't know what version the other users have, but on an
unprotected version of this file, they do not have this problem.

Does this problem have something to do with versioning, or
settings in Excel?

Thanks,

Lester

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run Time Error 1004 Unable to set hidden property

Just to add to Keepitcool's response.

By putting the code in the Auto_open sub in a general module, this code gets run
each time the workbook opens (well, if macros and startup macros are enabled).

So it should work without unprotecting, doing the work and reprotecting.

Lester wrote:

Thanks for the explanation Dave.

I put the code in and it protects the sheets now, but it gives me the
error with when I'm unhiding rows, and I have a lot of code that hides
and unhides rows throughout the workbook. Its there a way to put the
protection in the code and allow it to use the hidden command without
me having put a protect and unprotect code with every hidden command?

Thanks,

Lester

Dave Peterson wrote in message ...
xl2002 added a bunch more things you can do to a protected worksheet.

One of them is "format columns". xl2k (and before) didn't have this.

If you're using code, you may want to try to protect the worksheet the

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

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

(you could use the workbook_open even under ThisWorkbook, too.)

userinterfaceonly:=true allows your code to do more things than the users.

So I could do this:

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.Range("a1,e1").EntireColumn.Hidden = True
End With
End Sub



Lester Lee wrote:

Hi,

I'm experiencing problems with a run time error 1004 unable to set
hidden property. The problem is that the worksheet that I'm using is
protected, and on my PC, I do not get this error. But when some other
people open the file on their PC, they get this error. I'm currently
using Excel 2002 (10.2614.3501) SP-1, I don't know what version the
other users have, but on an unprotected version of this file, they do
not have this problem.

Does this problem have something to do with versioning, or settings in
Excel?

Thanks,

Lester

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson

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
Runtime Error 1004 Unable to set the top property of the picture c JB Bates[_2_] Excel Discussion (Misc queries) 1 March 3rd 10 08:04 PM
Error 1004: Unable to get the axis property Ana via OfficeKB.com Charts and Charting in Excel 1 June 24th 09 11:47 AM
Run-time Error '1004' Unable to get the findnext property... Tom Ogilvy Excel Programming 0 July 12th 04 04:27 PM
Run time error 1004 - Unable to get add property of the buttons class Mark[_37_] Excel Programming 0 March 1st 04 09:48 AM
Run-time error '1004' - Unable to set the Visible property of the Worksheet class Shalin Chopra Excel Programming 3 November 25th 03 08:38 PM


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