Sub getCSV()
Dim textline As String
Dim myVals As Variant
Dim i As Long
On Error Resume Next
Open ThisWorkbook.Path & "\tttt.csv" For Input As #1
Line Input #1, textline
myVals = Split(textline, " ")
With ActiveSheet
For i = 0 To 1
.Cells(i + 1, 1).Value = myVals(i)
Next
.Range("b5") = myVals(2)
.Range("e5") = myVals(3)
.Range("c5") = myVals(4)
End With
Close #1
End Sub
Sub crMain()
lastM = 0
Do
If lastM <> fMdfd Then
lastM = fMdfd
getCSV
End If
DoEvents
Loop
End Sub
Public Function fMdfd() As Variant
Dim fso As New filesystemobject
Dim theF As file
Set theF = fso.getfile(ThisWorkbook.Path & "\tttt.csv")
fMdfd = theF.DateLastModified
Set fso = Nothing
End Function作者: stillfish00 時間: 2014-7-9 23:16