Here's one way
Option Explicit
Sub drv()
Load UserForm1
UserForm1.Show
End Sub
Function Apple() As String
If Rnd <= 0.5 Then
Apple = "Success: Apple <= 0.5"
Else
Apple = "Fail: Apple > 0.5"
End If
End Function
Function Orange() As String
If Rnd <= 0.75 Then
Orange = "Success: Orange <= 0.75"
Else
Orange = "Fail: Orange > 0.75"
End If
End Function
Function Spinach() As String
If Rnd <= 0.95 Then
Spinach = "Success: Spinach <= 0.95"
Else
Spinach = "Fail: Spinach > 0.95"
End If
End Function
Option Explicit
Private Sub btnOK_Click()
Dim sApple As String, sOrange As String, sSpinach As String
Dim sMsg As String
sApple = vbNullString
sOrange = vbNullString
sSpinach = vbNullString
With Me
If .cbApple.Value Then sApple = Apple
If .cbOrange.Value Then sOrange = Orange
If .cbSpinach.Value Then sSpinach = Spinach
End With
If Len(sApple) > 1 Then sMsg = sMsg & sApple & vbCrLf
If Len(sOrange) > 1 Then sMsg = sMsg & sOrange & vbCrLf
If Len(sSpinach) > 1 Then sMsg = sMsg & Spinach & vbCrLf
Call MsgBox(sMsg, vbOKOnly + vbInformation, "Apple-Orange-Spinach")
Me.Hide
Unload Me
End Sub
Private Sub UserForm_Initialize()
With Me
.cbApple.Value = False
.cbOrange.Value = False
.cbSpinach.Value = False
End With
End Sub