ChooseColor
Again functions and declarations are in their own module.
Create a userform with a command button (CommandButton1) and add the following code to the form:
Option Explicit
Private Sub CommandButton1_Click()
Dim WasColor As Long
Dim IsColor As Long
WasColor = BackColor
If CDlgChooseColor(0&, IsColor) Then
BackColor = IsColor
MsgBox "Was color: " & WasColor & vbCrLf _
& "Is color: " & IsColor
End If
End Sub
A parent handle is not needed to call 'ChooseColor', but may be provided.
After clicking commandbutton1(Set Color) and selecting a color, the form background is repainted: