5
5

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 5 years have passed since last update.

[VBA]ダイアログでフォルダの選択を行う

Last updated at Posted at 2013-11-18

Qiita初投稿。
とりあえず手始めに。
wordでマクロ組むときに必要だったのでメモ。
VBAなので勿論Excelでも動くと思われる。

With Application.FileDialog(msoFileDialogFolderPicker)
   .Title = "テストタイトル"
   .AllowMultiSelect = False   'フォルダを複数選択できるようにするか?
   If .Show = -1 Then
        MsgBox ".SelectedItems(1)" & "が選択されました"
    Else
        MsgBox "選択されていません。"
    End If
End With

忘備録的な

  • SelectedItems(1)で選択したフォルダのディレクトリパスが取得できる。
  • if~は勿論別に無くても動く。
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?