.LOG文件使用拆态FSO的OPENTEXT打开,或者直接VBA里面OPEN打开,例子代码:
Dim MyCharOpen "f:\test.txt" For Input As #1
Do While Not EOF(1) 困御运 ' 循环至文件尾。
MyChar = Input(1, #1) ' 读入一个字符。
Debug.Print MyChar '汪梁 显示到立即窗口。
Loop
Close #1
我的excel是2003的,如果乱并侍你的哗吵不是,可能filedialog不能用,那蔽拦你就改一下别的方法来实现 它Dim a As String
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
a = .SelectedItems(1)
End With
If ActiveSheet.QueryTables.Count = 0 Then
ActiveSheet.QueryTables.Add Connection:="TEXT" &a, Destination:=Range("A1")
Else
ActiveSheet.QueryTables(1).Connection = "TEXT" &a
End If
With ActiveSheet.QueryTables(1)
.Name = "Log"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
.Destination = Range("A1")
End With
LOG10是工作表函数蚂没蚂,在VBA中要察早使用工作表闷埋函数,必须通过 WorksheetFunction 对象:Cells(3, k + 2).Value = Cells(6, 19) * Power((Cells(3, k) + 273) * (WorksheetFunction.Log10(Cells(3, 30)) + Cells(2, 23)) / 1000, 2) + Cells(6, 20) * Power((Cells(3, k) + 273) * (WorksheetFunction.Log10(Cells(3, 30)) + Cells(2, 23)) / 1000, 1) + Cells(6, 21)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)