Value must be of an Integer type - not string.
You can do something like this:
Code:
Option Explicit
Private Enum myMsgStyle
msgInformation = VBA.VbMsgBoxStyle.vbInformation
msgQuestion = VBA.VbMsgBoxStyle.vbQuestion
msgCritical = VBA.VbMsgBoxStyle.vbCritical
msgExclamation = VBA.VbMsgBoxStyle.vbExclamation
End Enum
Private Sub Command1_Click()
Dim opvalue As Integer
If Op1.Value = True Then opvalue = myMsgStyle.msgInformation
If Op2.Value = True Then opvalue = myMsgStyle.msgQuestion
If Op3.Value = True Then opvalue = myMsgStyle.msgCritical
If Op4.Value = True Then opvalue = myMsgStyle.msgExclamation
End Sub
or this
Code:
Private Sub Command1_Click()
Dim opvalue As Integer
If Op1.Value = True Then opvalue = VBA.VbMsgBoxStyle.vbInformation
If Op2.Value = True Then opvalue = VBA.VbMsgBoxStyle.vbQuestion
If Op3.Value = True Then opvalue = VBA.VbMsgBoxStyle.vbCritical
If Op4.Value = True Then opvalue = VBA.VbMsgBoxStyle.vbExclamation
End Sub