I am trying to loop through controls on a worksheet to set the mouse icon. It works fine on a form like this:
Sub SetFormControlCursors(form_name As UserForm, cursor_name As String)
Dim z As Control
For Each z In form_name.Controls
If TypeName(z) = "CommandButton" Then
z.MousePointer = fmMousePointerCustom
z.MouseIcon = LoadPicture(cursor_name)
End If
Next z
End Sub
but adapted for a worksheet, nothing happens:
Sub SetSheetCursors(sheetName As String, cursor_name As String)
Dim z As Shape
Dim s As String
Dim w1 As Worksheet: Set w1 = Sheets(sheetName)
For Each z In Sheets(sheetName).Shapes
If TypeName(z) = "CommandButton" Then
z.MousePointer = fmMousePointerCustom
z.MouseIcon = LoadPicture(cursor_name)
End If
Next z
End Sub
Any ideas why? The controls are Active X command buttons. Thanks!
Bookmarks