CommonDialog1.CancelError = True
On Error GoTo errhandler
Dim res As String
Dim Str1 As String
Str1 = App.Path & "/save" & "/振值/" & Date
res = Dir(Str1, vbDirectory) '判断有没有"str1"文件
If res = "" Then '没有该文件
MakeSureDirectoryPathExists Str1 & "/" '创建(api)
End If
CommonDialog1.InitDir = Str1
CommonDialog1.FileName = "振值.txt"
CommonDialog1.Filter = "(*.txt)|*.txt" 可打开文件类型
CommonDialog1.ShowOpen
If CommonDialog1.FilterIndex = 1 Then
If CommonDialog1.FileName <> "" Then
Dim s1 As String
Open CommonDialog1.FileName For Input As #1 '以读文件的方式打开;output:print以写的方式打开
Open App.Path & "/filename.set" For Binary As #Free_Num 'Binary 读二进制文件 get #1,,s1
i = 0
Do While Not EOF(1) '如果没到文件末尾则循环按行读取
's1 = Input(100, #1)
line Input #1, s1 '按行读取
If s1 <> "" Then
str = Split(s1, " ") '以空格为分界符,把str分解为数则形式
Num = UBound(str) '最大下标
If i = 0 Then
ReDim Strvalue(3, Num)
ReDim ArrayDate(Num)
For j = 0 To UBound(str)
ArrayDate(j) = str(j)
Next j
Else
For j = 0 To UBound(str)
Strvalue(i - 1, j) = str(j)
Next j
End If
End If
i = i + 1
If s1 = "" Then
i = i - 1
End If
Loop
Close #1
ReDim MaxStrvalue(3) As Single
For i = 0 To 3
If Strvalue(i, 0) <> "" Then
For j = 1 To UBound(str)
If Strvalue(i, j) > MaxStrvalue(i) Then
MaxStrvalue(i) = Strvalue(i, j)
End If
Next j
End If
Next i
End If