How can I add multiple lines of text in my Surfer text string through automation?

You can add a new line to a text string by including vbCrLf in the string.


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")

    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 1, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.