|
An even example, the method of adding data to the excel file is added to the display function of data collection! ! ! For the poster's reference!
Sub ShowDigitProc()
Screen.MousePointer = vbHourglass''''''''''' means waiting state
Dim xls As Object'Excel format output data
Set xls = CreateObject("Excel.Application")
xls.Visible = True
xls.Caption = "Four Signals"
Set xlbook = xls.Workbooks.Add'Excel format output data
Dim Row As Integer
Dim Col As Integer
Dim i, j As Integer
Dim channelpot As Integer
Dim ch0(511), ch1(511), ch2(511), ch3(511) As Single
channelpot = (4096-(4096 Mod ChannelCount))'The prototype is: channelpot = (8192-(8192 Mod ChannelCount))
For i = 0 To ChannelCount-1
s$ = s$ + "| CH" + Str$(Hist_Header.FirstChannel + i)
Next
Grid.FormatString = s$
s$ = ";"
For i = 0 + m_Offset To ((channelpot / ChannelCount)-1 + m_Offset)
s$ = s$ + "|" + Str$(i)
Next
Grid.FormatString = s$
'Open "D:\05.txt" For Output As #1''Read data in text format
For Row = 1 To ((4096-(4096 Mod ChannelCount)) / ChannelCount)
Col = 0''''''''''''''''''''''''''Data can be accessed!!!!!!!!!!!!!
Grid.TextMatrix(Row, Col + 1) = Format(((((InRegionUser((Row-1) * ChannelCount + Col) Xor&H2000) And&H3FFF)-&H2000) * PoltvalueChange) / 1000, "#.00000")
ch0(511) = Grid.TextMatrix(Row, Col + 1)
ch0(511) = Val(ch0(511))
Text3.Text = ch0(511)
xls.Cells(Row, 1).Value = ch0(511)'Excel format output data
Col = 1''''''''''''''''''''''''''Data can be accessed!!!!!!!!!!!!!
Grid.TextMatrix(Row, Col + 1) = Format(((((InRegionUser((Row-1) * ChannelCount + Col) Xor&H2000) And&H3FFF)-&H2000) * PoltvalueChange) / 1000, "#.00000")
ch1(511) = Grid.TextMatrix(Row, Col + 1)
ch1(511) = Val(ch1(511))
Text4.Text = ch1(511)
xls.Cells(Row, 2).Value = ch1(511)'Excel format output data
Col = 2''''''''''''''''''''''''''Data can be accessed!!!!!!!!!!!!!
Grid.TextMatrix(Row, Col + 1) = Format(((((InRegionUser((Row-1) * ChannelCount + Col) Xor&H2000) And&H3FFF)-&H2000) * PoltvalueChange) / 1000, "#.00000")
ch2(511) = Grid.TextMatrix(Row, Col + 1)
ch2(511) = Val(ch2(511))
Text5.Text = ch2(511)
xls.Cells(Row, 3).Value = ch2(511)'Excel format output data
Col = 3''''''''''''''''''''''''''Data can be accessed!!!!!!!!!!!!!
Grid.TextMatrix(Row, Col + 1) = Format(((((InRegionUser((Row-1) * ChannelCount + Col) Xor&H2000) And&H3FFF)-&H2000) * PoltvalueChange) / 1000, "#.00000")
ch3(511) = Grid.TextMatrix(Row, Col + 1)
Text6.Text = ch3(511)
xls.Cells(Row, 4).Value = ch3(511)'Excel format output data
'Write #1, ch0(511), ch1(511), ch2(511), ch3(511)''Read data in text format
'Draw_Click
'Picture2.PSet (ch0(511), ch2(511)), RGB(255, 0, 255)
Next
'Close #1''Read data in text format
Screen.MousePointer = vbDefault''''''''''''' means that the shape is determined by the object
End Sub |
|