Friday, 25 October 2013

Excel Macro to display a dialog box .



Sub messageBox()
'We can display message box / dialog box with yes/no buttons in excel macro using msgbox function

ret = MsgBox("Yes - No Buttons", vbYesNoCancel, "MessageBox Macro")
'Please note that second parameter in the function msgbox decided which buttons to display on the dialog 'box.

If ret = 6 Then
   MsgBox "You cliked on Yes"
ElseIf ret = 7 Then
   MsgBox "You cliked on No"
Else
  'ret = 2
  MsgBox "You cliked on Cancel"
End If

End Sub

What do you think on above excel macro topic? Please provide your input, comments, questions on excel macro. I will try to reply as soon as possible. I value your opinion on Excel Macros.

No comments:

Post a Comment

Popular Posts

Search This Blog