Active x change colour

niall91

New Member
Joined
Jul 21, 2020
Messages
45
Office Version
  1. 2019
Platform
  1. Windows
Hi

i want to loop through all active x objects and change colour
any ideas?
Thanks
VBA Code:
Sub controlBtnsColour(nme As String)
Dim objX As OLEObject
With Design
    For Each objX In .OLEObjects
        If Not TypeName(objX.Object) = nme Then
            objX.BackColor = 16777215'light grey
        End If
    Next
End With
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
This goes in the module of the worksheet containing the ActiveX controls to be affected:
VBA Code:
Sub ChangeColorOfAllControls()
    Dim objX As OLEObject
    For Each objX In Me.OLEObjects
        objX.Object.BackColor = 16777215   'light grey
    Next
End Sub
 
Upvote 0
Try:

VBA Code:
Sub controlBtnsColour()
  Dim objX As OLEObject
  For Each objX In ActiveSheet.OLEObjects
    objX.Object.BackColor = &HE0E0E0  'light grey
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,727
Messages
6,056,991
Members
444,902
Latest member
ExerciseInFutility

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top