Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open multi-workbooks w/ Window Scheduled Task? March Excel Programming 2 January 21st 09 07:41 PM
Open the Excel Workbooks in Windows Scheduled Task March Excel Programming 0 January 20th 09 06:08 PM
Workbooks.Open Fails Ed_P Excel Programming 3 September 27th 07 05:55 PM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. san Excel Programming 1 January 3rd 06 03:22 AM
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 Frank Jones Excel Programming 2 June 15th 04 03:21 AM


All times are GMT +1. The time now is 04:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"