![]() |
Workbooks.Open fails in scheduled job
Old Man River;544677 Wrote: If it is failing as a scheduled job then the permissions aren't set the same as when you are running while being logged in. Make sure you have the the scheduled job running with the same crediatials as when you are running from the command line. What error are you getting from the scheduled job I would put in the code for test a dbug statement. On Error Resume Next Workbooks.Open _ Filename:= "C:\Users\Alan\Documents\HSC\Fence Check\Fence Check Rota.xlsm" if Err.Number < 0 then ErrMessage = "Error Number = " & err.number shell("Echo " & ErrMessage & "C:\temp\Batch Job Error.txt") exit sub end if -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149871 |
Workbooks.Open fails in scheduled job
Thanks Joel and OssieMac
I do seem to have got this working now with my chnge to the code and by stopping the scheduled job being hidden. Both of you have been helpful and it is appreciated. Joel some of your debug tips will be useful in the future. "joel" wrote: Old Man River;544677 Wrote: If it is failing as a scheduled job then the permissions aren't set the same as when you are running while being logged in. Make sure you have the the scheduled job running with the same crediatials as when you are running from the command line. What error are you getting from the scheduled job I would put in the code for test a dbug statement. On Error Resume Next Workbooks.Open _ Filename:= "C:\Users\Alan\Documents\HSC\Fence Check\Fence Check Rota.xlsm" if Err.Number < 0 then ErrMessage = "Error Number = " & err.number shell("Echo " & ErrMessage & "C:\temp\Batch Job Error.txt") exit sub end if -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149871 . |
All times are GMT +1. The time now is 04:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com