Sign in to follow this  
Followers 0
jarek

Excel / COM problems? / Error: Variable must be of type "Object"

4 posts in this topic

#1 ·  Posted (edited)

Hello

I have prepared a script which works fine on my XP + Office 2007.

However the script will be used on Server 2008 + Office 2003.

The script below is just to show you the problem:

#include <WinAPI.au3>

$oExcel = ObjCreate("Excel.Application")

$oExcel.WorkBooks.Open("rz.xls")

It works on my local machine but fails on Server 2008 + Office 2003.

The message is:

Error: Variable must be of type "Object"

The file of course exists and is accessible.

I believe it has something to do with COM.

Please help me!

thanks,

Jarek

EDIT: I do not know what have I done but suddenly this script stopped working on my local machine (XP + Office 2007).

The error message is different:

The requested action with this object has failed

Edited by jarek

Share this post


Link to post
Share on other sites



First check if ObjCreate is returning an object. Check @error on return for errors and/or use IsObj().

If it quit working, try a restart to make sure all the processes are cleaned up.

Share this post


Link to post
Share on other sites

Specify the full path to the file. For example:

$oExcel.WorkBooks.Open("C:\somedir\rz.xls")

Share this post


Link to post
Share on other sites

Specify the full path to the file. For example:

$oExcel.WorkBooks.Open("C:\somedir\rz.xls")

thanks Juvigy, full path is the answer to my problem!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0