ユーザーの「ダウンロード」フォルダを指定するExcel VBAマクロです。
Path = CreateObject("Wscript.Shell").SpecialFolders("MyDocuments") & "\..\Downloads\"
■サンプルコードSub ダウンロードフォルダのエクセルファイルを選択する()
Dim Path As String
Path = CreateObject("Wscript.Shell").SpecialFolders("MyDocuments") & "\..\Downloads\"
ChDir Path
Dim myFile As Variant
myFile = Application.GetOpenFilename("エクセルファイル(*.xlsx),*.xlsx")
If VarType(myFile) = vbBoolean Then
MsgBox "キャンセルされました"
Else
MsgBox myFile & " が選択されました"
End If
End Sub
