Solved

Dialog Box

Posted on 2002-07-29
2
135 Views
Last Modified: 2010-04-24
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
Comment
Question by:SCOTT78
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7185301
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
 
LVL 39

Expert Comment

by:appari
ID: 7185367
use angellll's comment for VBOKCancel the constants to check are vbOK and vbCancel
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now