LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Enabling the Filter button in a class module/protected worksheet

I'm using a class to hook events for existing toolbar buttons as decribed
Professional Excel Development. The sheet that the code applies to is
protected with AllowFiltering. I want the user to be able to turn Filter on
and off. The only way I've found to do so is to set a dummy OnAction for
the filter button. This makes it available (all the time that the Worsheet
Menu Bar is visible, I think). Is there a better way? Here's the class
module code:

Public WithEvents filter_class_button_899 As CommandBarButton

Private Sub Class_Initialize()
Set filter_class_button_899 = Application.CommandBars.FindControl(ID:=899)
filter_class_button_899.OnAction = "dummy_sub"
End Sub

Private Sub Class_Terminate()
filter_class_button_899.Reset
End Sub

Private Sub filter_class_button_899_Click(ByVal Ctrl As
Office.CommandBarButton, CancelDefault As Boolean)
Call toggle_filter 'basically "range.Autofilter"
filter_class_button_899.State = Not filter_class_button_899.State
End Sub

Thanks,

Doug Glancy


 
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
Enabling Spell Check in Protected Worksheet Barb Reinhardt Excel Discussion (Misc queries) 2 May 10th 10 08:49 PM
Worksheet protected-auto filter works, show all button dosen't. Pink Gorman Excel Discussion (Misc queries) 2 August 20th 08 05:42 PM
Class module to filter textbox entry Shawn[_9_] Excel Programming 7 August 20th 04 12:53 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
Enabling comments on a protected worksheet S Phadke Excel Programming 1 September 2nd 03 09:37 PM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"