Skip to main content

Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba

Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba

Hello ErikAllen,
better long code then no code !!! The code helps to  understand what and how you do it.

If your local Excel version allows you to save to Sharepoint then it can be done with the Workbook.SaveAs Method.

Add at the end of your code before you close and clean up the Excel Object:


XLBook.SaveAs Filename:=sPath & sFile & ".xlsx"

 

where sPath and sFile are declared as follows: (you need to replace it with your path to sharepoint)

sPath = "Yourcompany-my.sharepoint.com/.../Documents"
sFile = "RumbaRocks"


Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba
Thank you @ndre that's great!
Does this same principle apply if I want to modify the existing excel in Sharepoint?
We have one Excel where all the information goes, we don't normally create new ones.

Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba

Yes, the same principle. Before you open the a online Excel from sharepoint use Workbooks.CanCheckOut Method (Excel) to check if the file can be checked out and then Workbooks.CheckOut.


Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba
Thanks @ndre, but i'm not too familiar with how to use these methods.
Like I said this template was pre-made and I modified it accordingly.
Would you have any examples of how I could get it to connect to the excel using the Workbooks.CanCheckOut?

Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba

Hi Erik, 

this works for me I'm running Excel 2016 (Office 16)

Sub Main
    Dim XLApp As Object ' Excel Application Object
    Dim XLBook As Object ' Excel WorkBook Object
    Dim XLSheet As Object ' Excel WorkSheet object
    Dim XLRange As Object ' Excel Range Object
    Dim XLWindow as Object 'Excell Window Object

    Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application

    Set XLBook = XLApp.Workbooks.Open("myserver.mydomain/.../MySharePointSpreadSheet.xlsx", ReadOnly:=False, Notify:=False) ' Open your Sharpoint Spreadsheet
    If XLBook.ReadOnly then
        Msgbox "The spreadsheet appears to be checked out"
        XLApp.Visible = 1
        Exit Sub
    End If
    XLApp.Visible = 1
End Sub

I attempt to open the workbook and if I get a read-only copy, I pop a message box indicating that the file may be checked out.

 

I'm not a fan of pragmatically editing Shared Document, what happens if something goes wrong. 
e.g. You lock the document in a hidden instance of Work Excel or whatever (and it's not obvious), or maybe you enter your data in the incorrect sheets (overwriting valid data) or you enter incorrect data, losing the original data.

I would strongly advise one to take a copy of the file before editing it, and archiving it so it can be retrieved later if needed (I'd keep 7 or 14 days worth of files).

Note: All of the above is really unrelated to RUMBA, it's standard Excel OLE/COM code, the best place to look for code samples is Google (GoogleIT is your friend :) Most of the VBA you find should run just fine in the script engine, however avoid VBA dialogs and remember Sub Main is the entry point in RUMBA Basic, so you will need to change the names of the subroutine when you pate into the Script editor.

There may well be instances where something in the Excel COM API doesn't work in the RUMBA Script engine, but there are normally alternate methods and objects which all for workaround. If you hit anything like that (in particular I'm thinking Ranges) let us know and we can try figure it out.

Tom


Hello everyone,

 

Everyday we collect some data and input it into an excel sheet which we keep on Sharepoint, which is cloud based.

I currently have a script that pulls that information and creates an excel sheet and then I copy it over.

Is it possible to have it directly place it into the cloud based one?

I used the sample template to create the script I currently use.

Sorry it's a bit long, I need to refine it.

 

Sub Main
'*****************************************************************************************************
' 5250 DemoHost to Excel Data Transfer ( Basic )
'
' This example connects to the Netmanage 5250Demohost.netmanage.com, brings up a data screen,
' opens a new Excel workbook and transfers data to Excel
'*****************************************************************************************************

'*****************************************************************************************************
' Define all variables
'*****************************************************************************************************
Dim XLApp As Object ' Excel Application Object
Dim XLBook As Object ' Excel WorkBook Object
Dim XLSheet As Object ' Excel WorkSheet object
Dim XLRange As Object ' Excel Range Object

Dim GoodData ' Variant to hold data value for transfer
Dim ScreenText As String ' Text read from host screen
Dim Row As Integer ' Screen Row
Dim Col As Integer ' Screen Column
Dim CurrentExcelCell As String ' String to hold Excel Cell reference, we are using the "A1" addressing

 

'*****************************************************************************************************
' Bring up Excel application and open a new Workbook
'*****************************************************************************************************

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
Set XLBook = XLApp.Workbooks.Add ' Create an EXCEL Workbook
Set XLSheet = XLBook.Worksheets("Sheet1") ' Create an EXCEL Worksheet
Set XLRange = XLSheet.Range("A1:A5") ' Create an EXCEL Range
XLRange.ColumnWidth = 17 ' Set Column Width
XLSheet.Activate ' Activate the Worksheet

'*****************************************************************************************************
' This section grabs the data from the host and places it in the appropriate Excel cell
' The data point screen locations are set manually into the program
'*****************************************************************************************************

EMConnect "A"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("A4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "B"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("B4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "C"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("C4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "D"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("D4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "E"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("E4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"

EMConnect "F"
EMSetCursor 20, 7
EMSendKey "dspsyssts<Enter>"
EMReadScreen ScreenText,5,1,72 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F1") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,7,5,73 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F2") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,4,6,35 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F3") = GoodData ' Write data point from screen to Excel
EMReadScreen ScreenText,6,7,33 ' Read the data point
GoodData = Str(ScreenText) ' Convert text to variant
XLSheet.Range("F4") = GoodData ' Write data point from screen to Excel
EMSendKey "<PF3>"


XLSheet.Application.Visible = True ' Show the EXCEL sheet


End Sub


#Rumba
Tom,

You make a very good point about overwriting data on a shared document.
I think it would be best if I just keep my way I am doing it now and just copy it over accordingly.

Thank you for your input!