Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

Dialog Box

How can I tell which button the user has selected within a Message Box?

I need to do this:
 
  If the user selects OK then do something or
if the user selects Cancel then do something.

The MsgBox has vbOKCancel

Thanks
Scott
0
SCOTT78
Asked:
SCOTT78
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
dim lngResult as long
lngResult = msgbox ("do yes or no", vbYesNo)
select case lngResult
  case vbYes
    'user has clicked yes
  case vbNo
    'user has clicked no
end select

CHeers  
0
 
appariCommented:
use angellll's comment for VBOKCancel the constants to check are vbOK and vbCancel
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now