I am trying to extract results from a 3rd party software into excel using a macro. To avoid any technical details, the macro basically extracts labels of elements present in the the third party software in a column in excel which i managed.
For each label in the column, the macro should be able to extract results associated with it in a column in excel.
e.g. if the labels are extracted in Range(A1:A10),Iam expecting associated results for the 10 labels to start off from B1 and B2 onwards.
So after running the macro it should pick label 1 from A1 extract the results in column B and then move onto label 2 in A2 and further extract results in column C and so on and so forth till label 10.An example looks as follows:
Sub runpred()
Connect
Dim J As Integer, Numsteps As Integer, i As Integer, offset As Integer
Dim wl As Integer, wb As String, countwell As Integer, LEBELTEMP As String, Dim filetoopen As String
filetoopen = Range("h1")
DoSlowCmd "GAP.OPENFILE(""" + filetoopen + """)"
Numsteps = DoGAPFunc("GAP.PREDINIT()")
Range("J3") = Numsteps
For J = 1 To Numsteps
DoGAPFunc ("GAP.PREDDOSTEP(0)")
Next J
offset = 4
countwell = 0
wl = DoGet("GAP.MOD[0].WELL.COUNT")
Range("G3") = wl
For i = 0 To wl - 1
wb = "GAP.MOD[0].WELL[" + CStr(i) + "]"
Range("g" + CStr(i + offset)) = DoGet(wb + ".LABEL")
Next
For J = 0 To 50
LEBELTEMP = Range("g" + CStr(i + offset))
Cells(3 + countwell, 1) = DoGet(("GAP.MOD[{PROD}].WELL[{" & LEBELTEMP & "}].PREDRES.DATES[" & J & "].Datestr"))
countwell = countwell + 1
Next J
Disconnect
The first part runs a prediction from the third party software highlighted in blue.
Part highlighted in orange extracts all the labels in a column.
Part highlighted in red indicates the results to be extracted in subsequent columns based on the differeing labels which I am not able to obtain.
Portion highlighted in grey represents the third party string to be used in macro for extraction purpose. The name of the label should be represented by LEBELTEMP somehow where LEBELTEMP.
Hopefully the query should be clear in solving the logic which Iam looking forward to solve.
Appreciate your help i nthis matter.
For each label in the column, the macro should be able to extract results associated with it in a column in excel.
e.g. if the labels are extracted in Range(A1:A10),Iam expecting associated results for the 10 labels to start off from B1 and B2 onwards.
So after running the macro it should pick label 1 from A1 extract the results in column B and then move onto label 2 in A2 and further extract results in column C and so on and so forth till label 10.An example looks as follows:
Sub runpred()
Connect
Dim J As Integer, Numsteps As Integer, i As Integer, offset As Integer
Dim wl As Integer, wb As String, countwell As Integer, LEBELTEMP As String, Dim filetoopen As String
filetoopen = Range("h1")
DoSlowCmd "GAP.OPENFILE(""" + filetoopen + """)"
Numsteps = DoGAPFunc("GAP.PREDINIT()")
Range("J3") = Numsteps
For J = 1 To Numsteps
DoGAPFunc ("GAP.PREDDOSTEP(0)")
Next J
offset = 4
countwell = 0
wl = DoGet("GAP.MOD[0].WELL.COUNT")
Range("G3") = wl
For i = 0 To wl - 1
wb = "GAP.MOD[0].WELL[" + CStr(i) + "]"
Range("g" + CStr(i + offset)) = DoGet(wb + ".LABEL")
Next
For J = 0 To 50
LEBELTEMP = Range("g" + CStr(i + offset))
Cells(3 + countwell, 1) = DoGet(("GAP.MOD[{PROD}].WELL[{" & LEBELTEMP & "}].PREDRES.DATES[" & J & "].Datestr"))
countwell = countwell + 1
Next J
Disconnect
The first part runs a prediction from the third party software highlighted in blue.
Part highlighted in orange extracts all the labels in a column.
Part highlighted in red indicates the results to be extracted in subsequent columns based on the differeing labels which I am not able to obtain.
Portion highlighted in grey represents the third party string to be used in macro for extraction purpose. The name of the label should be represented by LEBELTEMP somehow where LEBELTEMP.
Hopefully the query should be clear in solving the logic which Iam looking forward to solve.
Appreciate your help i nthis matter.