Maybe this as a basic concept
Sub CopySmartermDataToExcel()
Dim objSmarterm As Object
Dim objSession As Object
Dim strData As String
Dim arrLines() As String
Dim arrFields() As String
Dim i As Long, j As Long, rowNum As Long, colNum As Long
' Attempt to create an Smarterm object. Adjust the ProgID if needed.
On Error Resume Next
Set objSmarterm = CreateObject("EXTRA.System")
' Example ProgID, adjust as needed
If objSmarterm Is Nothing Then
MsgBox "Smarterm is not installed or the ProgID is incorrect.", vbExclamation
Exit Sub
End If
On Error GoTo 0
' Get the active session.
Set objSession = objSmarterm.ActiveSession
If objSession Is Nothing Then
MsgBox "No active Smarterm session found.", vbExclamation
Exit Sub
End If
' Copy the screen data. This often depends on how the data is structured.
' This is a VERY basic example, you'll need to adapt it.
strData = objSession.Screen.GetString(1, 1, objSession.Screen.Rows * objSession.Screen.Cols)
' Get everything.
' Split the data into lines.
arrLines = Split(strData, vbCrLf)
' Or vbLf, check your Smarterm data.
' Start writing to Excel from row 1, column 1.
rowNum = 1 colNum = 1
' Loop through each line and split into fields (if necessary).
For i = LBound(arrLines) To UBound(arrLines)
' Example: Split by spaces or tabs. Adjust as needed.
arrFields = Split(arrLines(i), vbTab)
' or " " or another delimiter.
' Write each field to a cell.
colNum = 1
' Reset column for each line.
For j = LBound(arrFields) To UBound(arrFields)
Cells(rowNum, colNum).Value = arrFields(j)
colNum = colNum + 1
Next j
rowNum = rowNum + 1
Next i
' Clean up objects.
Set objSession = Nothing
Set objSmarterm = Nothing
MsgBox "Data copied successfully!", vbInformation
End Sub