I'm trying to create an automatic datalink daily report. The objective is to use the task scheduler to open excel and then, using VBA, update all the data and calculations and finally sending by email the report. When I manualy open the excel file, everything is fine; the report updates itself and send the email.
However, when I try to open the excel file with a .bat (as it would be done by the task scheduler), all my VBA code is executed before to loading datalink. Therefore, the VBA code is returning an error and the execution stops. I'm using the Resize function to refresh the datalink data (as in here DataLink Function VBA Code )
Any idea on how to impose loading datalink with VBA code?