テスト20
'--------------------------
'ファイル検索と処理
'--------------------------
Sub Sample()
Dim Hiduke As String
Hiduke = Replace(Date, "/", "")
Call FileSearch("C:\Users\User\Desktop\経理関連", Hiduke)
End Sub
'-----------------------------------
Sub FileSearch(Path As String, Target As String)
Dim FSO As Object
Dim Folder As Variant
Dim File As Variant
Dim wb As Workbook
Dim Mrow As String
Set FSO = CreateObject("Scripting.FileSystemObject")
For Each File In FSO.GetFolder(Path).Files
' If File.Name Like Target Then
If InStr(File.Name, Target) > 0 Then
MsgBox File.Name
Set wb = Workbooks.Open(File.Path)
'-------------
'いろいろ処理
'-------------
wb.ActiveSheet.Select
Mrow = wb.ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
MsgBox Mrow
wb.Close SaveChanges:=True
End If
Next File
Set wb = Nothing
End Sub
Author And Source
この問題について(テスト20), 我々は、より多くの情報をここで見つけました https://qiita.com/tqr65rs/items/f6e65fc02f9854785c04著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .