Choosing the Version of Excel when opening an instance

D

Dave

I'm using vba with ms project and excel, pulling the tasks from project to
excel. I have excel 2007 and 2003 installed on my computer. By default
when I use
Set xlApp = New Excel.Application
xlApp.Visible = True
AppActivate "Microsoft Excel"

The 2007 version is used. I would like to use the 2003 version. Any help
is appreciated.

Cheers
 
J

Juan Pablo González

Try using

Set xlApp = CreateObject("Excel.Application.11")

Regards,

Juan Pablo González
 
J

Jim Rech

You might try re-registering Excel 2003. From Start->Run enter:

<Full path to Excel 2003>\Excel.exe /regserver

--
Jim
| I'm using vba with ms project and excel, pulling the tasks from project to
| excel. I have excel 2007 and 2003 installed on my computer. By default
| when I use
| Set xlApp = New Excel.Application
| xlApp.Visible = True
| AppActivate "Microsoft Excel"
|
| The 2007 version is used. I would like to use the 2003 version. Any help
| is appreciated.
|
| Cheers
|
|
 
J

Juan Pablo González

Weird, I don't have a machine with both of them installed, but on the
machine with 2007, that line creates a run time error, only when I change it
to Excel.Application.12 it works.

So, try what Jim Rech said and see if that helps.

Regards,

Juan Pablo González
 
D

Dave

Hmmm...in my references it only shows the office 12 objects, not excel 11.
I did re-register and it still does not show up....
 
D

Dave

Ok, this is what I had to do for it to work.

From Project, I had to disable the current reference I had to Office 12,
browse to the
C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.dll to add this
reference. Go back and add the Excel 12 reference, make sure that the
office 11 is before the excel 12 and it now works...

Thanks
 
T

Tom Ogilvy

the number on the end makes no difference - the last registered version is
started.

There is a KB article on this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top