投稿日 | : 2002/08/30(Fri) 12:02 |
投稿者 | : MANA |
URL | : |
タイトル | : 自動更新方法 |
このプログラムはコマンドをクリックして
ファイルを読み込むようにしてますが、これ
をフォルダ内を自動更新(5分置き)するよ
うにしたいのです。
どうやれば良いか教えてください。
Option Explicit
Private Const Mpath = "C:\DATA\"
Private kakutyosi As String
Private Nowdate As String
'***** テキストファイルを読み込む *****
Private Sub Command1_Click()
Dim strMyFile() As String
Dim strtextFile As String
Dim filekensaku As Integer
Dim i As Integer
Nowdate = Format$(Date, "yyyy-mm-dd") 'ファイルの名前は日付
kakutyosi = "TxT"
strtextFile = Dir$(Mpath & Nowdate & "\*.*")
Do While strtextFile <> ""
If StrComp(Right$(strtextFile, 3), kakutyosi, 1) = 0 Then
filekensaku = filekensaku + 1
ReDim Preserve strMyFile(filekensaku)
strMyFile(filekensaku) = strtextFile
End If
strtextFile = Dir$
Loop
For i = 1 To filekensaku
If FileLen(Mpath & Nowdate & "\" & strMyFile(i)) = 0 Then 'フ
ァイルサイズが1or0で判
別
Else
List1.AddItem strMyFile(i)
End If
Next i
End Sub
'***** テキストファイル読込み終了 *****