Written a small app in excel which analyses data from various sources and then spits out some data which is then passed to crystal reports. Everything worked fine until I tried to automate it from
VB so that it would run on task scheduler.
Now whenever I try and run it I get an error telling me that the first macro can't be found, it thens runs the rest of the macros without issue.
If I step through the code and use a dummy macro as the first it works and all the macros run, if I just run the app and tell it to resume next it still can't find the first real macro.
Tried pausing the macro run so that excel has time to load up properly etc, tried wait and sleep, tried loops that write to the spreadsheet and then access the macro but still always get the same problem.
the workbook incidentally works fine, its only when I try and run it from
VB that I have problems..
the code I'm usuing is fairly simple and I have used before and on other workbooks without issue.
Dim myExcel As Excel.Application
Set myExcel = CreateObject("Excel.Application")
myExcel.Visible = false
myExcel.Workbooks.Open (sPath & sFile)
myExcel.Run ("Get_My_Data()")
myExcel.Run ("Update_Stock_List()")
myExcel.Run ("Update_Price_List()")
myExcel.Run ("Generate_Files()")
help!