|
自分はこんな感じのを使ってます。
このファイルのあるフォルダに"Sub"フォルダを作成して
その中に処理したいファイルを入れてください。
取り出し条件は、
Private Function Fg_Chkの
Caseを変更してみてください。
Option Explicit
Sub Text_In()
Dim dat As String
Dim buf() As String
Dim i As Long
Dim Fg As Boolean
Dim MyPath, MyFile As String
ActiveSheet.Cells.ClearContents
Application.ScreenUpdating = False
MyPath = ThisWorkbook.Path & "\Sub\"
MyFile = Dir(MyPath & "*")
i = 1
Do Until MyFile = ""
Open MyPath & MyFile For Input As #1
Do Until EOF(1)
Line Input #1, dat
Fg = Fg_Chk(dat)
If Fg = True Then
buf = Split(dat, ",")
With ActiveSheet
.Range(.Cells(i, 1), .Cells(i, UBound(buf) + 1)).Value = buf
End With
i = i + 1
End If
Loop
Close #1
MyFile = Dir()
Loop
Application.ScreenUpdating = True
End Sub
Private Function Fg_Chk(dat As String) As Boolean
Select Case True
Case dat Like "*AA*"
Fg_Chk = True
Case dat Like "*担当者*"
Fg_Chk = True
Case dat Like "2006/07/07*"
Fg_Chk = True
Case Else
Fg_Chk = False
End Select
End Function
|
|