?
Solved

Dialog Box

Posted on 2002-07-29
2
Medium Priority
?
146 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month6 days, 4 hours left to enroll

589 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