LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Workbooks.Open fails in scheduled job

What is the error message that you are getting on the line that fails? I am
wondering if you have the correct full file name.

Open the workbook Fence Check Rota.xlsm

Open the VBA editor

Open the Immediate window. (Menu item View - Imediate window or Ctrl/G)

Copy and paste the following into the immediate window and press Enter.

? ThisWorkbook.FullName

Copy the returned result into your code.

--
Regards,

OssieMac


"Old Man River" wrote:

I am trying to run this code from a scheduled job. It works fine if I use the
Command Line (pasted below it) which is replicated in the scheduled job. The
Job ran succesfully, for which it had to wake the machine, but fails at the
Workbooks.Open statement. Any suggestions please.

Option Explicit

Sub Auto_Open()
'Stop
'Load and Work in the Fence Check Rota spreadsheet
Workbooks.Open _
Filename:= "C:\Users\Alan\Documents\HSC\Fence Check\Fence
Check Rota.xlsm"
Application.Run "'Fence Check Rota.xlsm'!Email_Turn"
ActiveWorkbook.Save
ActiveWindow.Close
'Now close the Fence Check Auto Run spreadsheet or quit XL if notthing
else open.
If Application.Workbooks.Count < 1 Then
ActiveWorkbook.Close
Else
Application.Quit
End If
End Sub

The command line is

"C:\Program Files\Microsoft Office\Office12\Excel.exe" /r
"C:\Users\Alan\Documents\HSC\Fence Check\Fence Check Auto Run.xlsm"

Running Vista

Thanks!

 
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
Workbooks.Open fails in scheduled job joel[_154_] Excel Programming 1 November 2nd 09 02:13 PM
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 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 09:08 AM.

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

About Us

"It's about Microsoft Excel"