How can I use Surfer Scripter to insert the cell contents from an Excel file as a text object?

To insert the contents of an Excel file cell into the plot document as a text object, you can open the data file in the Surfer worksheet and simply copy the contents from the cell in the worksheet and paste it into the plot window.


To run this script:

  1. Copy the script below.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 16\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. Press Ctrl+V to paste the script into Scripter. 
  6. Click Script | Run to run the script.


Sub Main
    Dim SurferApp, Plot, Wks As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Visible = True

    Set Plot = SurferApp.Documents.Add(srfDocPlot)

    'Open the data file in the worksheet
    Set Wks = SurferApp.Documents.Open(SurferApp.Path+"\samples\ColoradoCities.xls")

    'Set copy cell C5 in the worksheet

    'Paste cell contents into plot window

End Sub


The text object will remain static and won't update if the cell contents change in the Excel file. 


Updated November 8, 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.