When I refresh my Excel 2010 workbook using the Task Scheduler job or the SQL Server agent job, all images in the workbook are replaced with the red x. Both jobs call VBS script which runs a macro within the workbook. When I run that VBS script manually (by simply executing the script) there is no issue. What could be the reason and how can I fix it? I tried amending permissions on the Content.MSO folder for various users and nothing helps.
Code:
Set objExcel = CreateObject("Excel.Application.14")
Set objWorkbook = objExcel.Workbooks.Open("D:\Files In\test.xlsm")
objExcel.Application.Visible = False
objExcel.Application.Run "'test.xlsm'!MAIN_MACRO"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Saved = True
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
Set objExcel = Nothing
WScript.Quit