Finance

Charts

Statistics

Macros

Search

Retry and Cancel Buttons in Excel VBA

An example featuring the Retry and Cancel buttons, together with a critical warning icon, is shown in Figure.

The corresponding code is:

Sub MsgBoxRetryCancel()
    If MsgBox("An error occurred while saving the file." & vbCrLf & _
              "Do you want to try again?" & vbCrLf & _
              "Do you want to cancel the operation?", _
              vbRetryCancel Or vbCritical, _
              "Save Error") = vbRetry Then
        MsgBox "You chose to try again"
    Else
        MsgBox "You chose to cancel the operation"
    End If
End Sub

Explanation:
The Retry and Cancel buttons are combined with an icon that visually signals a critical warning.

0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx