Solved

Dialog Box

Posted on 2002-07-29
2
137 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Computer crashes, following error message in event manager 5 239
Copy a row 12 64
Spell Check in VB6 13 127
VB6 common control 6 sp6 object library not registerd 3 22
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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