Reply
 
Thread Tools Display Modes
  #1   Report Post  
wendy
 
Posts: n/a
Default start a new line in a form message box

Hi,
I am creating a message box as part of a form template using the code:

vAnswer = MsgBox(Prompt:="text", Buttons:=vbOKOnly)
If vAnswer = vbOK Then
Exit Sub
End If

The text I'd like to enter is a reminder to do 3 things, and I'd like each
item to appear on a new line. The help file suggested inserting Chr(13) -- a
carriage return -- to start a new line, but I can't figure out how to do
this. If I add Chr(13) within the quotes, it just appears as part of the
text. If I end the quotes, add Chr(13) and restart the quotes, I get an
error when I test the form.

Any suggestions for how specify new lines within the Prompt for a message
box???

Thanks in advance
  #2   Report Post  
Greg
 
Posts: n/a
Default

Wendy,

Use the & operator to conenct literal and string variables. Try one of
these:

Sub Text()

If MsgBox("Wash hands," & vbCr & "brush teeth," _
& vbCr & "and comb hair", vbOK) = vbOK Then
Exit Sub
End If
End Sub

Sub Text1()

If MsgBox("Wash hands," & Chr(13) & "brush teeth," _
& Chr(13) & "and comb hair", vbOK) = vbOK Then
Exit Sub
End If
End Sub

  #3   Report Post  
wendy
 
Posts: n/a
Default

Thanks very much Greg - that did the trick!

"Greg" wrote:

Wendy,

Use the & operator to conenct literal and string variables. Try one of
these:

Sub Text()

If MsgBox("Wash hands," & vbCr & "brush teeth," _
& vbCr & "and comb hair", vbOK) = vbOK Then
Exit Sub
End If
End Sub

Sub Text1()

If MsgBox("Wash hands," & Chr(13) & "brush teeth," _
& Chr(13) & "and comb hair", vbOK) = vbOK Then
Exit Sub
End If
End Sub


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bullets/numbers will not indent after first line Greg Microsoft Word Help 2 August 9th 05 12:43 AM
When I press enter in MS Word it does not start on the next line . Spencer Page Layout 1 January 18th 05 03:25 AM
Making a Form :: Line Borders / Table Cells with Flowing Text John Microsoft Word Help 1 January 2nd 05 02:42 PM
space @ start of line ted medin New Users 2 December 22nd 04 11:47 PM
When I start typing, the background for that line turns black and. I.Sharp New Users 1 December 10th 04 11:53 AM


All times are GMT +1. The time now is 02:14 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"