Hello Guys a i have a problem.
i am making an Form what will load data from PLC Siemens, but i stuck on the picking value.
I need pick or connect to the value from concatenate what will read my written value in textbox. Sending code
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
Function concatenate()
Dim jedna As String
Dim dva As String
Dim Pracoviste As String
Dim tri As String
Dim ctyri As String
Dim pet As String
Dim sest As String
Dim sedm As String
Dim Celek As String
Dim Dot As String
Dim Uv As String
jedna = "ns=3;s="
dva = "STATION_"
Pracoviste = nastaveniForm.pracovistebox.Value
ctyri = "_DB"
pet = "data_IN_OUT"
sest = "data_OUT"
sedm = "data"
Dot = "."
Uv = """"
'ns=3;s="STATION_18_DB"."data_IN_OUT"."data_OUT"."data"
Celek = jedna & Uv & dva & Pracoviste & tri & ctyri & Uv & Dot & Uv & pet & Uv & Dot & Uv & sest & Uv & Dot & Uv & sedm & Uv
nastaveniForm.pracovistebox.AddItem Celek.Value
pracovistebox.Text = ""
End Function
Sub hodnoty_Click()
Dim strNodeIdMethod As String
strNodeIdMethod = nastaveniForm.pracovistebox
Dim strValues() As String
'get arguments
On Error Resume Next
strValues = Sheets("Mereni").m_OpcUaClient.ReadStructUdt(strNodeIdMethod)
'error handling for ReadValues
If Err.Number <> 0 Then
MsgBox Err.Description
Exit Sub
End If
'Get array upper bound for call method function
Dim i, iUbound, iLbound, iRow As Integer
'print first string
iRow = 11
iUbound = (UBound(strValues) + 1) / 3 - 1
iLbound = LBound(strValues)
For i = iLbound To iUbound
Range("A" + Trim(str(iRow))).Value = strValues(i)
iRow = iRow + 1
Next
'print second string
iRow = 11
iUbound = ((UBound(strValues) + 1) / 3) * 2 - 1
iLbound = (UBound(strValues) + 1) / 3
For i = iLbound To iUbound
Range("B" + Trim(str(iRow))).Value = strValues(i)
iRow = iRow + 1
Next
'print third string
iRow = 11
iUbound = UBound(strValues)
iLbound = ((UBound(strValues) + 1) / 3) * 2
For i = iLbound To iUbound
Range("C" + Trim(str(iRow))).Value = strValues(i)
iRow = iRow + 1
Next
End Sub
Bookmarks