trouble with commandbarbutton.state

W

Wazooli

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
 
J

Jim Thomlinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top