Mark Kramer Mark Kramer - 7 months ago 38 Question

How to get text and a variable in a messagebox

I just need to know how to have plain text and a variable in a messagebox.

For example:

I can do this:


And I can do this:
MsgBox("Variable = ")

But I can't do this:
MsgBox("Variable = " + variable)

Ric Ric

As has been suggested, using the string.format method is nice and simple and very readable.

In the " + " is used for addition and the " & " is used for string concatenation.

In your example:

MsgBox("Variable = " + variable)


MsgBox("Variable = " & variable)

I may have been a bit quick answering this as it appears these operators can both be used for concatenation, but recommended use is the "&", source

maybe call