LoginSignup
1
2

More than 3 years have passed since last update.

Excel for macのVBAでフォルダ選択する方法

Last updated at Posted at 2020-09-24

macではFileSystemObjectを使えないので、代わりにMacScriptを使ってフォルダ選択ダイアログを表示する。

 Public Sub test()

    Dim SelectedPath As String

    SelectedPath = MacScript("return posix path of (choose folder with prompt ""Select the folder"") as string")

    Debug.Print SelectedPath

 End Sub

実行結果

/Users/ooki/OneDrive/Documents/Qiita記事/

日本語フォルダも正しく表示されてる。バッチリ。

確認バージョン

Excel for mac バージョン 16.41(20091302)

1
2
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
1
2