oic, can i direct upgrade from v5.5 to v7.2?
do u see anything wrong on below coding v6.1 ?
Sub vb_prover_gen_rpt()
Dim XL As Object
Dim FS As Object
Dim ***celFilePath As String
Dim sFileSave As String
Dim sPath As String
Dim sDateTime As String
Dim sDate As String
Dim sTime As String
Dim iRet As Integer
Dim i As Integer
Dim j As Integer
Dim iNo As Integer
Dim sStream_kf As Integer
Dim rStream_kf As Single
Dim rTemp As Single
Dim x(80,10) As Single
Dim xName As string
Dim xState As Integer
iRet = CicodeCallOpen("TagRead","ms_user_path")
sPath = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","ms_xdate")
sDate = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","ms_xtime")
sTime = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_STREAM_NO")
iNo = CicodeCallReturn()
x(4, 5) = iNo
iRet = CicodeCallOpen("TagRead","MI_PROVER_POINT")
x(5, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_DIAMETER")
x(9, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_WALL_THICK")
x(10, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_ELASTICITY")
x(12, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_TUBE_COEEF")
x(13, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_M_KF")
x(17, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_M_MF")
x(18, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_P_BASEVOL")
x(56, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTSP")
x(57, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPSP")
x(58, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTLP")
x(59, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPLP")
x(60, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CVOL")
x(61, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTLM")
x(65, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPLM")
x(66, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_KF")
x(70, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_RPT")
x(71, 5) = CicodeCallReturn()
x(72, 5) = ((x(18, 5)-x(70, 5))/x(18, 5))*100
iRet = CicodeCallOpen("TagRead","P_AVG_K_FACTOR")
x(73, 5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_FLOWRATE")
x(74, 5) = CicodeCallReturn()
For i = 26 To 35
iRet = CicodeCallOpen("TagRead","P_TRL_FR"+trim(str(i-25)))
x(i,2) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_MTMP"+trim(str(i-25)))
x(i,3) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_PTMP"+trim(str(i-25)))
x(i,4) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_MPRS"+trim(str(i-25)))
x(i,5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_PPRS"+trim(str(i-25)))
x(i,6) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_PLS"+trim(str(i-25)))
x(i,7) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_FREQ"+trim(str(i-25)))
x(i,8) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_SDENS"+trim(str(i-25)))
x(i,9) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_MF"+trim(str(i-25)))
x(i,10) = CicodeCallReturn()
Next i
For i = 43 To 52
iRet = CicodeCallOpen("TagRead","P_TRL_CTLM"+trim(str(i-42)))
x(i,2) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CPLM"+trim(str(i-42)))
x(i,3) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CTLP"+trim(str(i-42)))
x(i,4) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CPLP"+trim(str(i-42)))
x(i,5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CTSP"+trim(str(i-42)))
x(i,6) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CPSP"+trim(str(i-42)))
x(i,7) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_CVOL"+trim(str(i-42)))
x(i,8) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_TRL_FTIME"+trim(str(i-42)))
x(i,9) = CicodeCallReturn()
Next i
iRet = CicodeCallOpen("TagRead","P_AVG_FLOWRATE")
x(36,2) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_MTMP")
x(36,3) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_PTMP")
x(36,4) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_MPRS")
x(36,5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_PPRS")
x(36,6) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_PLS")
x(36,7) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_FREQ")
x(36,8) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_SDNS")
x(36,9) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_KF")
x(36,10) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTLM")
x(53,2) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPLM")
x(53,3) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTLP")
x(53,4) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPLP")
x(53,5) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CTSP")
x(53,6) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CPSP")
x(53,7) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_CVOL")
x(53,8) = CicodeCallReturn()
iRet = CicodeCallOpen("TagRead","P_AVG_FTIME")
x(53,9) = CicodeCallReturn()
On Error Resume Next
x(64, 5) = x(36,7)/x(17,5)
x(67, 5) = x(64,5)*x(65,5)*x(66,5)
***celFilePath = sPath + "REPORT\MASTER\CONDY_PROVER.xls"
sDateTime = Format(sDate, "dd_mmmm_yyyy") + "_" + Format(sTime, "hhnnss")
sFileSave = sPath + "REPORT\PROVER\PROVING_REPORTS\PVR_" + sDateTime + ".xls"
On Error Resume Next
Kill sFileSave
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(sFileSave) = 0 Then
FileCopy ***celFilePath, sFileSave
End If
Set XL = createObject("Excel.Application")
XL.Workbooks.Open (sFileSave)
'***(ROW,COL)***
For i = 26 To 53
For j = 2 To 10
If x(i,j) <> "" Then
XL.Cells(i,j) = x(i,j)
End If
Next j
Next i
For i = 4 To 18
If x(i,5) <> "" Then
XL.Cells(i,5) = x(i,5)
End If
Next i
For i = 56 To 74
If x(i,5) <> "" Then
XL.Cells(i,5) = x(i,5)
End If
Next i
XL.Cells(6,5) = sDate + " @ " + sTime
iRet = CicodeCallOpen("TagRead","MS_PROVER_OPERATOR")
XL.Cells(77,3) = CicodeCallReturn() 'Operator name
'SERVER CHECKING...........................................................
' iRet = CicodeCallOpen("ServerInfo","server",0)
' xName = CicodeCallReturn()
' iRet = CicodeCallOpen("IODeviceInfo","DISK_PLC",3)
' xState = CicodeCallReturn()
' If xName = "Citect1" And xState = 1 Then
' On Error Resume Next
' XL.ActiveSheet.Printout
' End If
' If xName = "Citect2" And xState = 2 Then
On Error Resume Next
XL.ActiveSheet.Printout
' End If
'..........................................................................
XL.ActiveWorkbook.Save
XL.application.quit
Set XL = Nothing
Set FS = Nothing
End Sub
'_______________________________________________________________________________________