Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Simple MsgBox question

I'm currently new to and studying VBA and having trouble understanding
the msgbox function.
Why is it that sometimes you have to include the arguments in
parentheses and other times you don't. I've noticed that when just a
prompt is required, it seems that the parentheses are not required.
Looked all over and haven't found an answer.
Thanks,
Greg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Simple MsgBox question

If you are just calling MsgBox there is no need for parantheses

Msgbox myMessage,vbYesNo

If you are returning the Msgbox result (the button pressed) and testing
that, parentheses are needed

If MsgBox(myMessage,vbYesNo) = vbYes Then
...

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gig" wrote in message
oups.com...
I'm currently new to and studying VBA and having trouble understanding
the msgbox function.
Why is it that sometimes you have to include the arguments in
parentheses and other times you don't. I've noticed that when just a
prompt is required, it seems that the parentheses are not required.
Looked all over and haven't found an answer.
Thanks,
Greg



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Simple MsgBox question

Just to add, that is a convention/the syntax for all functions and
subprocedures, not just for message boxes.

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote in message
...
If you are just calling MsgBox there is no need for parantheses

Msgbox myMessage,vbYesNo

If you are returning the Msgbox result (the button pressed) and testing
that, parentheses are needed

If MsgBox(myMessage,vbYesNo) = vbYes Then
...

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gig" wrote in message
oups.com...
I'm currently new to and studying VBA and having trouble understanding
the msgbox function.
Why is it that sometimes you have to include the arguments in
parentheses and other times you don't. I've noticed that when just a
prompt is required, it seems that the parentheses are not required.
Looked all over and haven't found an answer.
Thanks,
Greg





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
A simple inputbox & responding msgbox coding FARAZ QURESHI Excel Discussion (Misc queries) 4 May 5th 09 06:39 AM
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Msgbox needed johncassell[_40_] Excel Programming 2 February 24th 06 05:57 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


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