0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VB6 サンプルプログラム

Last updated at Posted at 2020-09-23

備忘録としてVisualBasic6のサンプルプログラムを掲載します。

フォルダー内にあるフォルダ名を取得する

Private Sub Form_Load()
    ' FileSystemObject (FSO) の新しいインスタンスを生成する
    Dim cFso As FileSystemObject
    Set cFso = New FileSystemObject

    ' Folder オブジェクトを取得する
    Dim cFolder As Folder
    Set cFolder = cFso.GetFolder("C:\Users")
    Set subFolder = cFolder.SubFolders

    ' 不要になった時点で参照を解放する (Terminate イベントを早めに起こす)
    Set cFso = Nothing

    Dim stPrompt As String

    ' すべてのファイルを列挙する
    For Each subFolder In cFolder.SubFolders
        stPrompt = stPrompt & subFolder.Name & vbNewLine
    Next subFolder

    ' 不要になった時点で参照を解放する (Terminate イベントを早めに起こす)
    Set cFolder = Nothing

    ' 取得したすべてのファイルパスを表示する
    Call MsgBox(stPrompt)
    
End Sub
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?