' 現在の日付を取得
Dim currentDate
currentDate = Year(Date) & "-" & Right("0" & Month(Date), 2) & "-" & Right("0" & Day(Date), 2)
' 保存先フォルダを指定
Dim saveFolderPath
saveFolderPath = "C:\Your\Custom\Folder\Path\"
' Internet Explorerのインスタンスを作成する
Set objIE = CreateObject("InternetExplorer.Application")
' Power BIのURLに移動する
objIE.Navigate "https://app.powerbi.com/"
' Power BIページの読み込みを待つ
Do While objIE.Busy
WScript.Sleep 1000
Loop
' ページが完全に読み込まれるのをさらに待つ
WScript.Sleep 5000
' ログインフォームを見つけて資格情報を入力する
objIE.Document.getElementById("i0116").Value = "あなたのユーザー名"
objIE.Document.getElementById("i0118").Value = "あなたのパスワード"
' ログインフォームを送信する
objIE.Document.getElementById("idSIButton9").Click
' ログインプロセスが完了するのを待つ
Do While objIE.Busy
WScript.Sleep 1000
Loop
' ページが完全に読み込まれるのをさらに待つ
WScript.Sleep 5000
' エクスポートしたいレポート/ダッシュボードに移動する
objIE.Navigate "https://app.powerbi.com/groups/あなたのグループID/reports/あなたのレポートID"
' レポート/ダッシュボードの読み込みを待つ
Do While objIE.Busy
WScript.Sleep 1000
Loop
' ページが完全に読み込まれるのをさらに待つ
WScript.Sleep 5000
' エクスポートボタンを見つけてクリックする
objIE.Document.getElementsByClassName("reportToolbarIcon icon icon-excel")[0].Click
' エクスポートプロセスが完了するのを待つ
WScript.Sleep 10000
' 保存ダイアログが表示されるのを待つ
WScript.Sleep 5000
' ファイル名に今日の日付を追加してファイルを保存する
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys saveFolderPath & "BIデータ_" & currentDate & ".xlsx"
objShell.SendKeys "{ENTER}"
' Internet Explorerを閉じる
objIE.Quit
Set objIE = Nothing