未分類

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

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. 記事内容確認

  2. 正官庄 効能

  3. fashion keyword

  4. 仕様書

  5. 意識調査

  6. アコーディオンと「続きを読む」

コメント

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

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

おすすめ記事

  1. 家事記事項目

    2019.04.14

  2. ライティング

    2018.10.24

PAGE TOP