Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to open multi-workbooks w/ Window Scheduled Task? | Excel Programming | |||
Open the Excel Workbooks in Windows Scheduled Task | Excel Programming | |||
Workbooks.Open Fails | Excel Programming | |||
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. | Excel Programming | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming |