Message Boxes are most often used as a means to quickly display information to the user. Message boxes can also be used to get basic Yes/No or Boolean type user input. Using Message boxes to get this kind of input can eliminate the need to develop custom UserForms to gather that information.
The MsgBox function returns a VbMsgBoxResult value which is an enumerated list with each item corresponding the button on the message box dialog selected by the user. The following code snippets illustrate the working with the MsgBox function to collect user input.
Dim msgResult As VbMsgBoxResult
' Display Yes and No buttons
msgResult = MsgBox("Do you ant to continue?", _
vbYesNo, "my Macro")
If msgResult = VbMsgBoxResult.vbYes Then
'User clicked Yes button
Else
'User clicked No button
End If
Last Month’s Tips:
MicroStation: Dimension InRoads: Working w/ AutoCAD Civil 3D 2014: VBA: Input BoxesAudit Utility New Open Roads … How to Create New Parts…
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now! Learn More ◊ Contact us today ◊ Newsletter ◊