Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I do this message box?


At the beginning of the my macro I would like a message/prompt box t
appear with a question on it.

if the user ticks/presses yes then the marco continues, if the use
presses/clicks no then the macro stops.

Thanks in advanc

--
CarolineHedge
-----------------------------------------------------------------------
CarolineHedges's Profile: http://www.excelforum.com/member.php...fo&userid=3570
View this thread: http://www.excelforum.com/showthread.php?threadid=56832

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How can I do this message box?

Public Sub MboxTest()

Dim mbRes As VbMsgBoxResult

mbRes = MsgBox("Do you want to continue?", vbYesNo, "MsgBox Test")

If mbRes = vbNo Then
Exit Sub
Else
'your code here
End If

End Sub



"CarolineHedges"
<CarolineHedges.2c0rrr_1154701507.9944@excelforu m-nospam.com schreef in
bericht news:CarolineHedges.2c0rrr_1154701507.9944@excelfo rum-nospam.com...

At the beginning of the my macro I would like a message/prompt box to
appear with a question on it.

if the user ticks/presses yes then the marco continues, if the user
presses/clicks no then the macro stops.

Thanks in advance


--
CarolineHedges
------------------------------------------------------------------------
CarolineHedges's Profile:
http://www.excelforum.com/member.php...o&userid=35705
View this thread: http://www.excelforum.com/showthread...hreadid=568326



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How can I do this message box?

Sub test()
Dim res As Long

res = MsgBox("Do you want to continue", _
vbYesNo Or vbQuestion, "My Macro")

If Not (res = vbYes) Then
MsgBox "Bye"
Exit Sub
End If

MsgBox "Let's go..."

End Sub

Regards,
Peter T

"CarolineHedges"
<CarolineHedges.2c0rrr_1154701507.9944@excelforu m-nospam.com wrote in
message news:CarolineHedges.2c0rrr_1154701507.9944@excelfo rum-nospam.com...

At the beginning of the my macro I would like a message/prompt box to
appear with a question on it.

if the user ticks/presses yes then the marco continues, if the user
presses/clicks no then the macro stops.

Thanks in advance


--
CarolineHedges
------------------------------------------------------------------------
CarolineHedges's Profile:

http://www.excelforum.com/member.php...o&userid=35705
View this thread: http://www.excelforum.com/showthread...hreadid=568326



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I do this message box?


Thank you!

Carolin

--
CarolineHedge
-----------------------------------------------------------------------
CarolineHedges's Profile: http://www.excelforum.com/member.php...fo&userid=3570
View this thread: http://www.excelforum.com/showthread.php?threadid=56832

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default How can I do this message box?

Here's one way.

Msg = "Your question?" ' Define message.
Style = vbYesNo ' Define buttons.
Title = "Title of message box" ' Define title.
If MsgBox(Msg, Style, Title) = vbNo Then End

MsgBox ("You selected Yes. Your code will continue")



"CarolineHedges"
<CarolineHedges.2c0rrr_1154701507.9944@excelforu m-nospam.com wrote in
message news:CarolineHedges.2c0rrr_1154701507.9944@excelfo rum-nospam.com...

At the beginning of the my macro I would like a message/prompt box to
appear with a question on it.

if the user ticks/presses yes then the marco continues, if the user
presses/clicks no then the macro stops.

Thanks in advance


--
CarolineHedges
------------------------------------------------------------------------
CarolineHedges's Profile:
http://www.excelforum.com/member.php...o&userid=35705
View this thread: http://www.excelforum.com/showthread...hreadid=568326





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How can I do this message box?

Careful using End in code. End is dangerous as it clears all global
variables/objects. You would be better off with Exit Sub...
--
HTH...

Jim Thomlinson


"PCLIVE" wrote:

Here's one way.

Msg = "Your question?" ' Define message.
Style = vbYesNo ' Define buttons.
Title = "Title of message box" ' Define title.
If MsgBox(Msg, Style, Title) = vbNo Then End

MsgBox ("You selected Yes. Your code will continue")



"CarolineHedges"
<CarolineHedges.2c0rrr_1154701507.9944@excelforu m-nospam.com wrote in
message news:CarolineHedges.2c0rrr_1154701507.9944@excelfo rum-nospam.com...

At the beginning of the my macro I would like a message/prompt box to
appear with a question on it.

if the user ticks/presses yes then the marco continues, if the user
presses/clicks no then the macro stops.

Thanks in advance


--
CarolineHedges
------------------------------------------------------------------------
CarolineHedges's Profile:
http://www.excelforum.com/member.php...o&userid=35705
View this thread: http://www.excelforum.com/showthread...hreadid=568326




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
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
Replace Excel Message w/Custom Message Kevin R Excel Programming 1 May 18th 06 04:13 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Opening an attachment of a message that has a message as attachmen vetron Excel Programming 0 January 30th 06 06:17 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


All times are GMT +1. The time now is 09:13 PM.

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"