ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msgBox problem (https://www.excelbanter.com/excel-programming/412517-msgbox-problem.html)

Jeff Ciaccio

msgBox problem
 
I would like to used named parameters in a msgBox, but this does not seem to
work.
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & " m/s,
and the starting velocity was " & vInit1 & ", so the Delta v was " & (vel -
vInit1) & " m/s", Title:="End of first period")

When I leave off the named paramter, it works just fine (without a title).
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & " m/s,
and the starting velocity was " & vInit1 & ", so the Delta v was " & (vel -
vInit1) & " m/s")

Am I doing something wrong with the named parameter?

Thanks

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog: http://sprayberry.typepad.com/ciaccio


Sandy Mann

msgBox problem
 
Try removing the parenthesis:

MsgBox "Time period 1: " & vbLf & "The ending velocity was " & vel & _
" m/s, and the starting velocity was " & vInit1 & ", so the Delta v was " _
& (vel - vInit1) & " m/s", Title:="End of first period"

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jeff Ciaccio" wrote in message
...
I would like to used named parameters in a msgBox, but this does not seem
to work.
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was " &
(vel - vInit1) & " m/s", Title:="End of first period")

When I leave off the named paramter, it works just fine (without a title).
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was " &
(vel - vInit1) & " m/s")

Am I doing something wrong with the named parameter?

Thanks

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:
http://sprayberry.typepad.com/ciaccio





Jeff Ciaccio

msgBox problem
 
That did the trick, but how does the following work?? Notice the
parenthesis are included, and this compiles and runs fine. Wierd :)
msg = MsgBox(OutputString, Title:="Your prime numbers")


"Sandy Mann" wrote in message
...
Try removing the parenthesis:

MsgBox "Time period 1: " & vbLf & "The ending velocity was " & vel & _
" m/s, and the starting velocity was " & vInit1 & ", so the Delta v was "
_
& (vel - vInit1) & " m/s", Title:="End of first period"

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jeff Ciaccio" wrote in message
...
I would like to used named parameters in a msgBox, but this does not seem
to work.
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was " &
(vel - vInit1) & " m/s", Title:="End of first period")

When I leave off the named paramter, it works just fine (without a
title).
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was " &
(vel - vInit1) & " m/s")

Am I doing something wrong with the named parameter?

Thanks

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:
http://sprayberry.typepad.com/ciaccio






Sandy Mann

msgBox problem
 
Because the response from the Mesaage Box, (ie the button pressed), is being
assigned to the variable msg. The Parenthsis in you original code was
making XL think that you want to assign a variable and so it said that it
expected a "=". With no parenthsis is just give a message so no assignment
is necessary.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jeff Ciaccio" wrote in message
...
That did the trick, but how does the following work?? Notice the
parenthesis are included, and this compiles and runs fine. Wierd :)
msg = MsgBox(OutputString, Title:="Your prime numbers")


"Sandy Mann" wrote in message
...
Try removing the parenthesis:

MsgBox "Time period 1: " & vbLf & "The ending velocity was " & vel & _
" m/s, and the starting velocity was " & vInit1 & ", so the Delta v was "
_
& (vel - vInit1) & " m/s", Title:="End of first period"

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jeff Ciaccio" wrote in message
...
I would like to used named parameters in a msgBox, but this does not seem
to work.
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was "
&
(vel - vInit1) & " m/s", Title:="End of first period")

When I leave off the named paramter, it works just fine (without a
title).
MsgBox ("Time period 1: " & vbLf & "The ending velocity was " & vel & "
m/s, and the starting velocity was " & vInit1 & ", so the Delta v was "
&
(vel - vInit1) & " m/s")

Am I doing something wrong with the named parameter?

Thanks

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:
http://sprayberry.typepad.com/ciaccio










All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com