Thursday, April 23, 2015

VBA Input Box and Message Box Response to Stop or Run a Macro

How Run or Stop a Macro with VBA Input Box and Message Box Responses
Sub Run_Stop_Macro()

Alert = MsgBox("The Macro will Update the Report with Latest Data ", vbYesNo, "Do You Wants to Update the Data Now ?")
If Alert = vbNo Then Exit Sub

ReTry:
PW = InputBox("Enter the Password To Run a Macro", "Please Enter the Password", vbOKCancel)

If PW = vbNullString Then Exit Sub

If Application.Proper(PW) <> "Tamatam" Then
MsgBox "Please Enter the Correct Password", vbCritical, "Wrong Password! Try Again!"
GoTo ReTry:
End If

'Macro Code Stuff for Your Requirement here.....You Go......

End Sub

Thanks,
TAMATAM

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog