Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@Industrialcontrolbamboo

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions