#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Msgbox

How do i use VKokCancel in a message box
I can't get it to work?

regards alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Msgbox

One way:


Dim nResult As Long
nResult = MsgBox(Prompt:="Erase your hard drive?", _
Buttons:=vbOKCancel)
If nResult = vbCancel Then
MsgBox "You cancelled..."
Else
MsgBox "Just kidding!"
End If


,
Alvin Hansen wrote:

How do i use VKokCancel in a message box
I can't get it to work?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Msgbox

Set a variable to the MsgBox results

ans = MsgBox(...)

and test that for vbOK or vbCancel

If ans = vbOK then
...
ElseIf ans = vbCancel Then
...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in message
...
How do i use VKokCancel in a message box
I can't get it to work?

regards alvin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Msgbox

Sub ABCD()
Dim ans As Long
ans = MsgBox("Ok or Cancel?", vbOKCancel)
If ans = vbOK Then
MsgBox "You clicked OK"
ElseIf ans = vbCancel Then
MsgBox "You clicked cancel"
End If
End Sub

--
Regards,
Tom Ogilvy


"Alvin Hansen" wrote in message
...
How do i use VKokCancel in a message box
I can't get it to work?

regards alvin



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Msgbox

Thank you all

So simpel............................................ .

regards alvin


"Tom Ogilvy" skrev:

Sub ABCD()
Dim ans As Long
ans = MsgBox("Ok or Cancel?", vbOKCancel)
If ans = vbOK Then
MsgBox "You clicked OK"
ElseIf ans = vbCancel Then
MsgBox "You clicked cancel"
End If
End Sub

--
Regards,
Tom Ogilvy


"Alvin Hansen" wrote in message
...
How do i use VKokCancel in a message box
I can't get it to work?

regards alvin






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Msgbox

Funny AND helpful... Cheers

"JE McGimpsey" wrote:

One way:


Dim nResult As Long
nResult = MsgBox(Prompt:="Erase your hard drive?", _
Buttons:=vbOKCancel)
If nResult = vbCancel Then
MsgBox "You cancelled..."
Else
MsgBox "Just kidding!"
End If


,
Alvin Hansen wrote:

How do i use VKokCancel in a message box
I can't get it to work?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox James Coughlan Excel Discussion (Misc queries) 3 May 3rd 06 01:57 PM
Msgbox pushp Excel Programming 3 August 30th 04 09:31 PM
help with Msgbox helmekki[_12_] Excel Programming 1 June 21st 04 05:03 PM
MsgBox Help! rbanks Excel Programming 4 November 21st 03 04:17 PM
msgbox Marcus Excel Programming 3 November 19th 03 11:35 PM


All times are GMT +1. The time now is 03:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"