To create a multi-line text string you'll need to insert a new line in the desired string. To add a new line to a text string, include vbCrLf in the string as shown below.
Plot.Shapes.AddText("line1" & vbCrLf & "line2")
The vbCrLf constant consists of a carriage return Chr(13) and a line feed Chr(10). For more information about Visual Basic string constants, refer to the BASIC Language Help accessed from the Scripter Help menu.
Sub Main Dim SurferApp, Plot, Text, FontFormat As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible=True Set Plot = SurferApp.Documents.Add Set Text = Plot.Shapes.AddText(5,7, "This is my text"& vbCrLf & "This is my text on the second line") Set FontFormat = Text.Font FontFormat.HAlign = srfTACenter End Sub
Updated November 2021