Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default AllowFiltering vs EnableAutoFilter

Hello,

With regard to Autofiltering on a protected sheet, can anyone tell me what the difference (if any) is between these 2 code segments?

ActiveSheet.Protect Contents:=True,Userinterfaceonly:=True,AllowFilter ing:=True

or

ActiveSheet.Protect Contents:=True, Userinterfaceonly:=True
ActiveSheet.EnableAutoFilter = True

I seem to get the same results, using either one. Can't seem to find a definitive answer on any of the forums, etc.

Thank you,

Regards

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default AllowFiltering vs EnableAutoFilter

Hello,

With regard to Autofiltering on a protected sheet, can anyone tell me
what the difference (if any) is between these 2 code segments?

ActiveSheet.Protect
Contents:=True,Userinterfaceonly:=True,AllowFilter ing:=True

or

ActiveSheet.Protect Contents:=True, Userinterfaceonly:=True
ActiveSheet.EnableAutoFilter = True

I seem to get the same results, using either one. Can't seem to find
a definitive answer on any of the forums, etc.

Thank you,

Regards

Dave


Your 1st implementation is a Worksheet.Protect parameter and was
introduced/added in XL2002.

The 2nd implementation is a Worksheet property, and is how this was
done in versions earlier than XL2002.

Using the 1st implementation raises an error if your project is run in
earlier versions. Since they both achieve the same thing, I use the 2nd
implementation only because I do not have to reset protection to turn
it off/on, and some clients still run XL2000.

Note, though, that some of the protection parameters do not persist
after closing the file. For example, if you use code to modify locked
cells on a protected sheet then protection must be removed and reset
for the 'UserInterfaceOnly' parameter to work.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default AllowFiltering vs EnableAutoFilter


Hi Garry,

Thanks for your reply.

Your 1st implementation is a Worksheet.Protect parameter and was
introduced/added in XL2002.

The 2nd implementation is a Worksheet property, and is how this was
done in versions earlier than XL2002.


I kind of suspected it was a "version" thing, but couldn't seem to locate an authoritative answer.

Using the 1st implementation raises an error if your project is run in
earlier versions. Since they both achieve the same thing, I use the 2nd
implementation only because I do not have to reset protection to turn
it off/on, and some clients still run XL2000.


I understand, makes sense to me.

Note, though, that some of the protection parameters do not persist
after closing the file. For example, if you use code to modify locked
cells on a protected sheet then protection must be removed and reset
for the 'UserInterfaceOnly' parameter to work.


Right, I've run into that one!

Thanks again Garry, much appreciated.

Regards,

Dave
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default AllowFiltering vs EnableAutoFilter

You're welcome, Dave! Thanks for the feedback...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
Protect with AllowFiltering Jérémie Gent Excel Programming 4 April 3rd 06 01:37 PM


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