Dim objExcel, objWorkbook Dim strFilePath Dim objShell ' Access a specific environment variable (e.g., PATH) Set objShell = CreateObject("WScript.Shell") ' Pfad zur Excel-Datei strFilePath = objShell.Environment("Process")("xlsxfile") WScript.Echo "Excel File: " & strFilePath ' Excel-Anwendung starten Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True ' Optional: Excel sichtbar machen ' Arbeitsmappe öffnen Set objWorkbook = objExcel.Workbooks.Open(strFilePath) ' Daten aktualisieren objWorkbook.RefreshAll ' Warten, bis die Aktualisierung abgeschlossen ist Do While objExcel.CalculationState <> 0 Or objWorkbook.Refreshing WScript.Sleep 100 ' 100 Millisekunden warten Loop ' Änderungen speichern objWorkbook.Save ' Excel beenden objExcel.Quit ' Objekte freigeben Set objWorkbook = Nothing Set objExcel = Nothing WScript.Echo "Daten aktualisiert und gespeichert." ' Optional: Erfolgsmeldung