How do you add a new line in a MsgBox message ?
Trying to put these 3 lines into one MsgBox message:
MsgBox "Shape 1 Name: " & shp1.Name, , ""
MsgBox "Shape 2 Name: " & shp2.Name, , ""
MsgBox "Shape 3 Name: " & shp3.Name, , ""
This works:
MsgBox "This information is on the first line. " & vbNewLine & _
"This information is on the 2nd line. " & vbNewLine & _
"This infornation is on the 3rd line. "
This doesn't:
MsgBox "Shape 1 Name: " & shp1.Name, , "" & vbNewLine & _
"Shape 2 Name: " & shp2.Name, , "" & vbNewLine & _
"Shape 3 Name: " & shp3.Name, , ""
The whole code:
' Button alpha ALL IPB
Sub Button_alpha_ALL_IPB()
Dim rng As Range
Dim shp1 As Shape
Dim shp2 As Shape
Dim shp3 As Shape
Const DIA As Single = 9
Const LINEWGHT As Single = 1
On Error Resume Next
Set rng = Application.InputBox(Title:="1/4 Select Shape Range", _
Prompt:="", _
Type:=8)
Set shp1 = ActiveSheet.Shapes.AddShape(9, rng.Left + 5, _
rng.Top + ((rng.Height - DIA) / 2), _
DIA, _
DIA)
With shp1
.Name = Application.InputBox(Title:="2/4 Enter Name Level 1", _
Default:="_L1", _
Prompt:="", _
Type:=2)
.Shadow.Visible = False
.Fill.Visible = True
.Fill.ForeColor.RGB = vbGreen
.Line.Visible = False
.Line.ForeColor.RGB = vbRed
.Line.Weight = LINEWGHT
.Line.Transparency = 0
End With
Set shp2 = ActiveSheet.Shapes.AddShape(9, rng.Left + 19, _
rng.Top + ((rng.Height - DIA) / 2), _
DIA, _
DIA)
With shp2
.Name = Application.InputBox(Title:="3/4 Enter Name Level 2", _
Default:="_L2", _
Prompt:="", _
Type:=2)
.Shadow.Visible = False
.Fill.Visible = True
.Fill.ForeColor.RGB = vbGreen
.Line.Visible = False
.Line.ForeColor.RGB = vbRed
.Line.Weight = LINEWGHT
.Line.Transparency = 0
End With
Set shp3 = ActiveSheet.Shapes.AddShape(9, rng.Left + 33, _
rng.Top + ((rng.Height - DIA) / 2), _
DIA, _
DIA)
With shp3
.Name = Application.InputBox(Title:="4/4 Enter Name Level 3", _
Default:="_L3", _
Prompt:="", _
Type:=2)
.Shadow.Visible = False
.Fill.Visible = True
.Fill.ForeColor.RGB = vbGreen
.Line.Visible = False
.Line.ForeColor.RGB = vbRed
.Line.Weight = LINEWGHT
.Line.Transparency = 0
End With
MsgBox "Shape 1 Name: " & shp1.Name, , ""
MsgBox "Shape 2 Name: " & shp2.Name, , ""
MsgBox "Shape 3 Name: " & shp3.Name, , ""
' MsgBox "This information is on the first line. " & vbNewLine & _
' "This information is on the 2nd line. " & vbNewLine & _
' "This infornation is on the 3rd line. "
'
' MsgBox "Shape 1 Name: " & shp1.Name, , "" & vbNewLine & _
' "Shape 2 Name: " & shp2.Name, , "" & vbNewLine & _
' "Shape 3 Name: " & shp3.Name, , ""
' On Error GoTo 0
End Sub
Thank you!
Bookmarks