WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Excel 2007 and Windows Server 2008 x64 Problem

 Keywords: 1261 Ole Exception Task Scheduler Scheduled Excel 2007 Windows Server 2008 x64 x86 32 64 bit Problem COM Open Method

Question:

I have a script that runs sucessfully on Windows server 2008, when it is run manually. However if I try to launch this script using the Windows task Scheduler the script fails when trying to open an excel workbook using the COM Open method. I added DebugTrace to the beginning of the script and it produced the folloiwng trace file:
************************************************************
*** Debug Initialized ***
==============================
Wed 3/30/2011 1:21:29 PM
WinBatch 32 2011A
WIL DLL 6.11aka
C:\Program Files (x86)\WinBatch\System\Test.wbt
Windows platform: NT, version: 5.2, build: 3790 (Service Pack 1)
ErrorMode: @CANCEL
Valid Code Signature: Yes
UAC Manifest Settings: level="highestAvailable" uiAccess="true"
UAC Elevation Level: Unsupported Platform
==============================

ret = fileexist("C:\Data\Test.xls")
(78) VALUE INT => 1

If ret == 1
(78) IF DO==>TRUE

directory = 'C:\Data\Test\'
(78) VALUE STRING => "C:\Data\Test\"

DirChange( directory )
(78) VALUE INT => 1

filename = FileItemize( '*.xls' )
(78) VALUE UNICODE => Test.xls

objXL = ObjectCreate("Excel.application")
(141) VALUE INT/COMOBJ => 308276892

objXL.Visible = @FALSE
(156) VALUE VARIANT_BOOL => 0

objXL.UserControl = @FALSE
(156) VALUE VARIANT_BOOL => 0

objXL.DisplayAlerts = @FALSE
(156) VALUE VARIANT_BOOL => 0

objWBKs = objXL.Workbooks
(156) VALUE INT/COMOBJ => 310906316

objWBK = objWBKs.Open( 'C:\Data\Test\Test.xls' )
(234) VALUE INT => 0

TERMINAL WIL ERROR=>1261 (Ole: Exception)

;;;END OF JOB;;;

---------- Begin structure stack dump ----------
  1 if                  5 If ret == 1                      DCFHighlands1.wbt
-------- End structure stack dump --------

---------- Begin WWWBATCH.INI dump ----------
[WBDKA44I]
[WWINT44I]
[COM Sub-system]
Function=InvokeMember
ErrorCode=9 (0x80020009)
ErrorDesc=Exception occurred.

[COM Exception]
Microsoft Office Excel=Unable to get the Open property of the Workbooks class

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same...

----------- End WWWBATCH.INI dump -----------

Answer:

The failing trace file contains extended error information from Excel. The [Com Exception] section states:
[COM Exception]
Microsoft Office Excel=Unable to get the Open property of the Workbooks class

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same...
I did some research on this issue. Specifically I searched for the keywords 'Unable to get the Open property of the Workbooks class'. Based on my findings, it looks like a bug with Excel 2007 when running a scheduled taskon Windows Server 2008.

Please check out the following thread: http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required

Apparently the solution is...

On, Windows 2008 Server x64, Please make this folder:

C:\Windows\SysWOW64\config\systemprofile\Desktop

On, Windows 2008 Server x86, Please make this folder:

C:\Windows\System32\config\systemprofile\Desktop

Hopefully this resolves your issue.

User Reply:

THANK YOU…It worked!!
Article ID:   W18105
Filename:   Excel 2007 and Windows Server 2008 x64 Problem.txt
File Created: 2011:03:30:11:29:20
Last Updated: 2011:03:30:11:29:20