未分類

ファイル一覧抽出ツールを作ってみよう

Sub get_ichiran(path)

 

    Dim fs As Variant

    Dim fld As Variant

    Dim ichiran As Variant

    Dim file As Variant

 

    Set fs = CreateObject(“Scripting.FileSystemobject”) ‘Folderオブジェクトに変換

    Set fld = fs.GetFolder(path)

    Set ichiran = fld.FileSystemobject  ‘ファイル一覧を取得

 

    For Each file In ichiran

        ActiveCell.Value = path

        ActiveCell.Offset(0, 1).Value = file.Name

        ActiveCell.Offset(0, 2).Value = file.DataLastModified

        ActiveCell.Offset(0, 3).Value = file.Size

        ActiveCell.Offset(1, 0).Select

    Next file

    

    Dim subpathichiran As Variant

    Set subpathichiran = fld.SubFolders ‘サブフォルダ一覧を取得

    

    For Each subpath In subpathichiran

        path = subpath

        get_ichiran (path)

    Next subpath

    

    Set fs = Nothing

    Set fld = Nothing

    Set ichiran = Nothing

    Set subpathichiran = Nothing

    

End Sub

関連記事

  1. toukoutesuto

  2. kajidaikou

  3. 正官庄 効能

  4. 表スクロール

  5. 靴 ブランド

  6. 意識調査

コメント

  1. この記事へのコメントはありません。

  1. この記事へのトラックバックはありません。

おすすめ記事

  1. 家事記事項目

    2019.04.14

  2. ライティング

    2018.10.24

PAGE TOP