Start excel 2002 from excel 2003

LeifGund
05-20-2008, 05:38 AM
I have an application that runs OK on excel2002 (excel vers. 10) but breaks in excel 2003 vers 11.

I would like to make a temporary fix until the problem has been solved.

I sub-class Excel.11 and use the workbook_Open event to see if it is my (problematic) type of book, then Open an instance of the excel.10 and open the book in it.
Any ideas on how to due this, and the code below will just open the same excel.11 application.
(Excel 10 and 11 seems to have the same class name).

pseudocode
...
if(isProblematic(WB)) then
Set oExcel10 = CreateObject("Excel.application") ' This is where I need help.
With oExcel10.workbooks.Open(WB.fullname)
end if
...

Timbo
05-20-2008, 06:00 AM
I think
CreateObject("Excel.Application.10")
will do it

LeifGund
05-20-2008, 06:25 AM
If invoked from excel.11 it does not open an excel.10
I have used a workaround (wb is the workbook that excel.11 is trying to open:

hWnd = Shell("C:\Program Files\Microsoft Office\Office10\EXCEL.EXE " & Chr(34) & Wb.FullName & Chr(34), vbNormalFocus)
If hWnd <> 0 Then
Wb.Close
appExcel.WindowState = xlMinimized
End If 'hwnd>0


If I do this, is there a way to get a hold of the object from the handle to the Window (hwnd) that Shell returns?

Timbo
05-21-2008, 02:44 AM
Not using VB/VBA that I know of, but you can use 'GetoObject' after opening the file to return a handle to the workbook :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum