No.2ベストアンサー
- 回答日時:
こんばんは。
If f.Attributes < 1024 Then '特別なフォルダは除外
これだけで済むかは不明
'//
Option Explicit
Private myRange As Range
Private FSO As Object
Private Const DST As String = "C:\X\" '末尾には¥を入れる
Sub FindAndCopy1()
Const mPath = "C:\Z\" '末尾には¥を入れる
Set myRange = Range("A2", Cells(Rows.Count, 1).End(xlUp)) 'A列
Set FSO = CreateObject("Scripting.FileSystemObject")
FileSearchN mPath
Set FSO = Nothing
End Sub
Sub FileSearchN(Path As String)
Dim buf As Variant
Dim f As Object
Dim ret As Variant
buf = Dir(Path & "\*.pdf") '拡張子
Do While buf <> ""
ret = Application.Match(buf, myRange, 0)
If IsNumeric(ret) Then
If Not FSO.FileExists(DST & buf) Then
FSO.CopyFile Path & "\" & buf, DST
End If
End If
buf = Dir()
DoEvents
Loop
With FSO
For Each f In .GetFolder(Path).SubFolders
If f.Attributes < 1024 Then '特別なフォルダは除外
Call FileSearchN(f.Path)
End If
DoEvents
Next f
End With
End Sub
No.1
- 回答日時:
以下が参考になると思います
ファイル検索の処理速度をUPさせるには?
http://www.moug.net/faq/viewtopic.php?t=70650
moug は6ヶ月でQAは消えるみたいなので・・・
※ 前回のご質問
VBAを使用した保存方法
http://oshiete.goo.ne.jp/qa/8961276.html
急いでいた?
問題が解決できたのか、わかりませんが
回答した側にとっては、役に立ったのかくらいは知りたいものです。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
Windows10でコマンドプロンプト...
-
デスクトップの画像をhtmlに表...
-
期間を指定したフォルダの削除...
-
Access VBA で フォルダ権限...
-
VBScriptでのフォルダ指定ダイ...
-
VBA 最新のフォルダ取得
-
C ファイル出力で、フォルダが...
-
excelマクロ 冒頭3文字が一致す...
-
エクセル 一つ上の階層の別フ...
-
VBScriptでフォルダ内の全ファ...
-
[VBS] Unicodeの文字化けを防ぎ...
-
多量のファイルをフォルダに自...
-
META-INFフォルダの置き場所に...
-
フォルダの場所を可変にしたい...
-
フォルダにリンクを貼りたい
-
フォルダを自分ごと削除
-
PSPICE 9.1 STUDENT VERSION ...
-
ThisWorkbookがあるフォルダ更...
-
EXCELのセルにフォルダのパスの...
-
Excelのハイパーリンクについて...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
Windows10でコマンドプロンプト...
-
VBA 最新のフォルダ取得
-
ファイル名と同名のフォルダを...
-
デスクトップの画像をhtmlに表...
-
Excelのハイパーリンクについて...
-
VBプロジェクトでのフォルダ構...
-
会社のネットワーク上のファイ...
-
【マクロ】ファイル名の日付に...
-
パス名に2バイト文字(マルチバ...
-
Access VBA で フォルダ権限...
-
カレントフォルダって?
-
VBA フォルダ名に特定の文字を...
-
ExcelVBAでフォルダへのハイパ...
-
C ファイル出力で、フォルダが...
-
excelマクロ 冒頭3文字が一致す...
-
保存先のフォルダ名を指定した...
-
マクロVBAのフォルダ階層別で検...
-
Excelで指定したフォルダに保存...
-
ディレクトリ名変更してコピー...
-
vbsで選択ダイアログを表示した...
おすすめ情報