The following code is supposed to save status of option buttons and check boxes in the current sheet into the registry on the click of a button:
And then whenever the file is opened, the following code is supposed to retrieve the saved defaults from the registry:
But, as usually ( ) it doesn't work, although there are no error messages.
Any ideas would be much appreciated...
Code:
Sub CommandButton2_Click()
Dim ctrl As OLEObject
Dim CtrlType As String
For Each ctrl In Me.OLEObjects
CtrlType = TypeName(ctrl)
If CtrlType = "CheckBox" Or CtrlType = "OptionButton" Then
SaveSetting APPNAME, "Defaults", ctrl.Name, ctrl.Value
End If
Next ctrl
MsgBox "Current settings have been saved as default!"
End Sub
Code:
Private Sub Workbook_Open()
Dim ctrl As OLEObject
Dim CtrlType As String
For Each ctrl In Me.OLEObjects
CtrlType = TypeName(ctrl)
If CtrlType = "CheckBox" Or CtrlType = "OptionButton" Then
ctrl.Value = GetSetting(APPNAME, "Defaults", ctrl.Name, ctrl.Value)
End If
Next ctl
End Sub
Any ideas would be much appreciated...