![]() |
trouble with commandbarbutton.state
Can anyone tell me why the following code does not change the button state?
Sub component_EOP() Dim comp_rng As Range Dim comp_list_end As Long Dim comp_con As CommandBarButton Set comp_rng = Workbooks("reports.xls").Worksheets("Components"). Range("d1:d65535") Set comp_con = CommandBars("End of list").Controls("component_EOP") comp_con.FaceId = 82 comp_list_end = Application.WorksheetFunction.CountA(comp_rng) Workbooks("reports.xls").Worksheets("Components"). Activate If ActiveWindow.ScrollRow = 1 Then ActiveWindow.ScrollRow = comp_list_end - 10 comp_con.state = msoButtonDown Else ActiveWindow.ScrollRow = 1 comp_con.state = msoButtonUp End If End Sub |
trouble with commandbarbutton.state
What is going on with your Activewindow.ScrollRow The cose for changing the
state is fine (near as I can tell) so I am wondering if the code is ever executing. A few things to try. Place a break point to see what code is executing. Change around the button state to ensure that the button state toggle works correctly. -- HTH... Jim Thomlinson "Wazooli" wrote: Can anyone tell me why the following code does not change the button state? Sub component_EOP() Dim comp_rng As Range Dim comp_list_end As Long Dim comp_con As CommandBarButton Set comp_rng = Workbooks("reports.xls").Worksheets("Components"). Range("d1:d65535") Set comp_con = CommandBars("End of list").Controls("component_EOP") comp_con.FaceId = 82 comp_list_end = Application.WorksheetFunction.CountA(comp_rng) Workbooks("reports.xls").Worksheets("Components"). Activate If ActiveWindow.ScrollRow = 1 Then ActiveWindow.ScrollRow = comp_list_end - 10 comp_con.state = msoButtonDown Else ActiveWindow.ScrollRow = 1 comp_con.state = msoButtonUp End If End Sub |
All times are GMT +1. The time now is 04:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com