Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Read and Write Cell Values in VBSReoGrid Control using VBS #534

Open
Industrialcontrolbamboo opened this issue Dec 24, 2024 · 0 comments

Comments

@Industrialcontrolbamboo

I am currently working on a project using WINCC and I am utilizing the VBSReoGrid control to load and manipulate an Excel file. I have successfully loaded an Excel file into the ReoGrid control, but I am having trouble reading and writing cell values using VBS (VBScript).
On Error Resume Next

Dim Grid
Set Grid = ScreenItems("Grid")

' Load Excel file
Grid.Load("C:\Recipes\POE配方报表模板.xlsx")

' Write text to specific cells, e.g., E6 to E9
Dim row
For row = 5 To 8 ' Row index 5 to 8 (E6 to E9)
Grid.SetCellText row, 4, "Test Value " & (row + 1)
Next

' Read values from E6 to E9
Dim cellValue
For row = 5 To 8 ' Row index 5 to 8 (E6 to E9)
cellValue = Grid.GetCellText(row, 4) ' Assuming GetCellText method is available

' Check and display the cell value
If IsEmpty(cellValue) Or IsNull(cellValue) Then
    MsgBox "The value in cell E" & (row + 1) & " is empty."
Else
    MsgBox "The value in cell E" & (row + 1) & " is: " & cellValue
End If

Next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant