3

is there a way to display a 2 or 3 or 4 or n line message on a pop-up window in vba 6 ?

For the moment my pop-up window ( calling the MsgBox function) displays the message like this :

       You did something wrong. Please enter valid input.

and I want it to display the message like this

      You did something wrong. 
     Please enter valid input.

can you please provide a code sample?

many thx in advance, radu

Filburt
  • 17,626
  • 12
  • 64
  • 115
Radu Puspana
  • 115
  • 1
  • 4
  • 12

2 Answers2

11

Just add a newline in your message:

MsgBox "Text 1" & vbNewLine & "text 2.
Hans Olsson
  • 54,199
  • 15
  • 94
  • 116
  • can you please direct me to more of the vba vbConstants? – Radu Puspana Feb 15 '11 at 15:05
  • 3
    @Radu: Not sure where to get an exhaustive list, but this [article](http://support.microsoft.com/kb/211774) has a small list. Otherwise just type vb and then press `Ctrl + Space` and the autocomplete will give you a list. – Hans Olsson Feb 15 '11 at 15:08
  • good tip. I'll have to keep that one in mind. Learn something new every day. – Patrick Feb 15 '11 at 15:18
  • thanks a lot for the article, and for the intelisense suggestion. that and F1 will give me a place to start. many many thx!!! – Radu Puspana Feb 15 '11 at 15:26
4

Relatively easy request

    iResult = MsgBox("This information is on the first line. " & vbCrLf & "This information is on the 2nd line. " &vbCrLf & _
        "Do you wish to continue?", vbYesNo + vbInformation, "Message Box")
Patrick
  • 7,512
  • 7
  • 39
  • 50
  • hey, thank you very much!!!, haven't got the chance to test it, but 11 gold medals say a lot more than I can say :) – Radu Puspana Feb 15 '11 at 15:23