まず、参照がほとんどインストールされておらず、Office がまったくインストールされていないマシンでコードを実行していると言わなければなりません。
コマンドで「explorer.exe」インスタンスを開き、Shell
フォルダーを参照し、選択した(または新しく作成した)フォルダーを入力し、最後にMsgBox
(同時にポップアップする)「OK」をクリックして閉じてShell
、変数への選択されたフォルダー パス。
それを達成する方法がわかりません。を使用するCurDir
と、選択したフォルダーではないフォルダーを取得してしまいます。
使用されたコード(機能しませんでした):
Sub BrowseForFolder()
ActualDir = "D:\"
Call Shell("C:\Windows\explorer", ActualDir, 1)
If Msgbox("Browse into folder or create a new one and then browse into it, then click ok", vbOkOnly, "Browse") = vbOk Then
' here should be the command to return the path. The following doesn't work since it returns always "D:\"
ActualDir = CurDir
End If
' Here I have to close the Shell - I have no idea what to write to do it
End Sub