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

Hi
Why does this not work?
MsgBox("message", vbYesNo, "title")
If I do this it does
a = MsgBox("message", vbYesNo, "title")
Why do I need to assign the result to a variable?
Thanks
Jo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default msgbox

Jo

just remove the brackets ...

MsgBox "message", vbYesNo, "title"

Regards

Trevor


"Jo" wrote in message
...
Hi
Why does this not work?
MsgBox("message", vbYesNo, "title")
If I do this it does
a = MsgBox("message", vbYesNo, "title")
Why do I need to assign the result to a variable?
Thanks
Jo



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default msgbox

Hi
try
MsgBox "message", vbYesNo, "title"

--
Regards
Frank Kabel
Frankfurt, Germany

"Jo" schrieb im Newsbeitrag
...
Hi
Why does this not work?
MsgBox("message", vbYesNo, "title")
If I do this it does
a = MsgBox("message", vbYesNo, "title")
Why do I need to assign the result to a variable?
Thanks
Jo


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

Hi Jo,

You don't have to assign the MsgBox to a variable, but the fact that you
specify Yes and No buttons is giving the user a choice, and so it is
reasonable to assume you are interested in that response.

MsgBox is a function, which means that it returns a result. You can capture
the value returned or ignore it if you want, but the syntax is different
depending upon your choice.

For all Functions, if you want to capture the value, it is

result = Function _Call([arg1[, arge2[, arg3[, ...]]]])

If you don'r want to capture the return value, you omit the brackets

Function _Call [arg1[, arge2[, arg3[, ...]]]]

Thus in your case, either of the following works, although in the second
case you will never know whichj button was pressed

a = MsgBox("message", vbYesNo, "title")

MsgBox "message", vbYesNo, "title"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jo" wrote in message
...
Hi
Why does this not work?
MsgBox("message", vbYesNo, "title")
If I do this it does
a = MsgBox("message", vbYesNo, "title")
Why do I need to assign the result to a variable?
Thanks
Jo



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 bumper338 Excel Discussion (Misc queries) 1 December 22nd 06 11:32 PM
msgbox flow23 Excel Discussion (Misc queries) 0 January 10th 06 03:25 PM
MsgBox Randal W. Hozeski Excel Programming 1 January 2nd 04 08:54 PM
Msgbox help JonoB Excel Programming 2 October 27th 03 03:06 PM
Msgbox Bernd[_2_] Excel Programming 0 October 24th 03 10:20 AM


All times are GMT +1. The time now is 06:53 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"