I have a script file that I'm executing via Task Scheduler that worked fine in Windows 7, and is not working in Windows 10.
Here's the code snippet:
Dim myxlApplication, myWorkBook
Set myxlApplication = CreateObject("Excel.Application")
myxlApplication.Visible = False
Set myWorkBook = myxlApplication.Workbooks.Open( emlAttach )
myxlApplication.DisplayAlerts = False
myWorkBook.Application.Run "Main.Main"
myxlApplication.DisplayAlerts = True
myxlApplication.Quit
Set myxlApplication = Nothing
emlAttach
is set earlier in the script to the absolute path and filename with extension.
When executing this via clicking on the script file, it works perfectly. When running it as a scheduled task, or forcing a run from task scheduler, it asks me what program I'd like to use to open the file. If I select Excel, it gives me an error telling me that the file doesn't exist.
The file extension on that error is wrong, xlsx
vs what is qualified by the variable xlsb
.