excel:vba-folder
フォルダを取得するVBA
Dim folderPath As Variant With Application.FileDialog(msoFileDialogFolderPicker) If .Show = True Then folderPath = .SelectedItems(1) End If End With
指定のフォルダがなければ作成する
Dim folderPath As String folderPath = ThisWorkbook.Path & "/hoge" If Dir(folderPath, vbDirectry) = "" Then MkDir folderPath End If
Dir関数でフォルダの存在を確認した後、存在しなければ作成する流れにしています。
excel/vba-folder.txt · 最終更新: by shimehitsu14