Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Create & manipulate new instance of Excel 2007 from within 2003

Status
Not open for further replies.

hotbread

Technical User
Mar 13, 2006
42
AU
Is there any way to create an instance of the Excel 2007 application using VBA in Excel 2003? That is, if I have a workbook open in Excel 2003, can I use VBA in that workbook to run Excel 2007 and manipulate a worksheet?

I tried using:

Dim xl2007 As Excel.Application
Set xl2007 = CreateObject("Excel.Application")

But that just creates another instance of Excel 2003, and I don't know how to make the CreateObject run Excel 2007 instead.
 
Ok... I've been able to achieve part of what I want, but still have a problem.

The following code runs Excel 2007 from within Excel 2003, opens a workbook, then uses GetObject to reference the Excel 2007 application:

Dim x7 As Excel.Application, x
x = Shell("C:\Program Files\Microsoft Office\Office12\EXCEL.EXE C:\Book2007.xls", 1)
Set x7 = GetObject("C:\Book2007.xls").Application

My problem is that I cannot set a reference to the Excel 2007 Object Library in 2003 because Excel 12.0 doesn't appear in the reference list.

Is there any way to reference the Excel 2007 (12.0) Object Library in Excel 2003? Seems easy enough in Word 2003 because 'Microsoft Excel 12.0 Object Library' appears in the reference list.
 


Then BROWSE to it.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
If I need to browse to it, what file should I be looking for, and where would it be located? I browsed to the EXCEL.EXE file in the Office12 folder, and tried to add it as a reference but nothing happened - no error, and it wasn't added to the list of references.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top