VBScript and Excel

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
MacschedStudent
Junior Coder
Posts: 36
Joined: Fri Oct 12, 2007 5:55 pm
Location: federal way wa
Contact:

VBScript and Excel

Post by MacschedStudent » Tue Oct 16, 2007 2:22 am

frustrated


Gentlemen:

I have been writing VBScript for 3 years now. I have tried everything I know. And I still can’t get a script to run successfully that interacts with Excel. Granted I have never tried working with Excel and VBScript before. But it can be that different. Here is the simplest script I can find I tried this in and outside of Macro Scheduler:

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("e:\test.xls")


the error returned is

Line 2 Character 1
Object Required objExcel

I also tried
Dim objExcel
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("e:\test.xls")



– at that point I got :

Line 3 Character 1
– with nothing specified for the object


Could there be something wrong with Excel itself???

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Oct 16, 2007 7:26 am

There is nothing wrong with this code. Works fine for me. So I guess your Excel installation must be broken. As you say, it fails to work outside of Macro Scheduler also. I would reinstall Excel, or do a Repair from Control Panel/Add Remove...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

dont work for me

Post by Aaron » Sat Jan 24, 2009 11:56 pm

im using excel 2007 in vista and I get the same thing.
Was this resolved with a new install

Thanks
Aaron

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Jan 25, 2009 9:35 pm

I'm also using Excel 2007 in Vista.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Post by Aaron » Mon Jan 26, 2009 1:29 am

very odd
Aaron

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts