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 copy/paste the contents from the cell in the worksheet into the plot window. The script below shows how to do this via automation
To run this script:
- Copy the script below.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- Press Ctrl+V to paste the script into Scripter.
- 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 Wks.Cells("C5").Copy 'Paste cell contents into plot window Plot.Shapes.Paste Wks.Close End Sub
The text object will remain static and won't update if the cell contents change in the Excel file.
Updated November 2021