J
Joyce
Hello,
I have a variety of controls on my worksheets, including checkboxes, radio
buttons, text buttons and files displayed as icons.
I have code that clear these when the user is ready to begin from scratch
again.
The following code works fine, but I'm not sure how to add the code for the
icons. These will probably be Word files or pdf for the most part.
Thanks.
Dim Ctrl As OLEObject
'Clear check boxes
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "CheckBox" Then
Ctrl.Object.Value = False
End If
Next Ctrl
End With
'Clear radio buttons
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "OptionButton" Then
Ctrl.Object.Value = False
End If
Next Ctrl
End With
'Clear text boxes
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "TextBox" Then
Ctrl.Object.Value = ""
End If
Next Ctrl
End With
I have a variety of controls on my worksheets, including checkboxes, radio
buttons, text buttons and files displayed as icons.
I have code that clear these when the user is ready to begin from scratch
again.
The following code works fine, but I'm not sure how to add the code for the
icons. These will probably be Word files or pdf for the most part.
Thanks.
Dim Ctrl As OLEObject
'Clear check boxes
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "CheckBox" Then
Ctrl.Object.Value = False
End If
Next Ctrl
End With
'Clear radio buttons
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "OptionButton" Then
Ctrl.Object.Value = False
End If
Next Ctrl
End With
'Clear text boxes
With ActiveSheet
For Each Ctrl In .OLEObjects
If TypeName(Ctrl.Object) = "TextBox" Then
Ctrl.Object.Value = ""
End If
Next Ctrl
End With