Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I Didn't know you could do this 1

Status
Not open for further replies.
Apr 27, 2006
126
GB
Didn't know you could call an input box from within a msgbox statement, but apparantley you can, after me faffing around with it. Hopefully it will be of some use to someone in the future (although, I can't think why other than to cut down on code and variables)

Code:
MsgBox (Val(InputBox("First Number")) + Val(InputBox("Second Number")))



hope it helps someone, somewhere, with something :)

________
clueless
 
Interesting...

Thanks for the post.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Hi there,

Yes it's possible, much like a lot of things in the programming world. I'm not so sure it's a good idea though, unless you don't want any control over the code. It is good to know the limits to which we can use our tools though. :)

-----------
Regards,
Zack Barresse
 
And of course there is no error trapping on Val. If you put in "asbvht" in Inputbox 1, and "12" in Inputbox2 the message is "12"...no error.

Gerry
My paintings and sculpture
 
Not totally impractical. It could be used to concatenate text...for some purpose or another...maybe.
Code:
Msgbox Inputbox("First answer?") & " and " & _
    Inputbox("Second answer?")
Yes, Enter, No, Enter would return "Yes and No".

Mind you...it is still looking for something useful to do. However, maybe not as a message box, but a string passed somewhere?

WHATever....

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top