From: Desaivres Alain on
Hi

Both Excel 2003 and Excel 2007 are installed on a subset of machines
How to control the object version open when this script line is executed ?
Set appXL = CreateObject("Excel.Application")

The test on two machines shows that it is the xcel 2003 (version 11.0) that
is opened, the same one you get if you doubleclick on an .xls file while
neither Excel 2k3 nor Excel 2k7 is opened...

Does it mean there is somewhere a variable that tell to Office which Excel
to open in case several would be installed ?

Thanks for your help
Alain


From: Estaup on
I would think the Office Library version being referenced in your code would
dictate the version of Excel being initiated.

I don't have both on one machine here, but looking at Excel projects on both
03 and 07, there are different libraries referenced.

Does the 03 version show in your references?


"Desaivres Alain" wrote:

> Hi
>
> Both Excel 2003 and Excel 2007 are installed on a subset of machines
> How to control the object version open when this script line is executed ?
> Set appXL = CreateObject("Excel.Application")
>
> The test on two machines shows that it is the xcel 2003 (version 11.0) that
> is opened, the same one you get if you doubleclick on an .xls file while
> neither Excel 2k3 nor Excel 2k7 is opened...
>
> Does it mean there is somewhere a variable that tell to Office which Excel
> to open in case several would be installed ?
>
> Thanks for your help
> Alain
>
>
From: Steve Yandl on
There are a number of indicators in the registry where the current version
is identified. I suspect the registry value for the key
HKEY_CLASSES_ROOT\Excel.Application\CurVer is the one in play here.

I don't have a system to test this on but I think you might be able to
launch your preferred version using 'Shell' and pointing to the appropriate
exe file and then grab your application object using 'GetObject' instead of
'CreateObject'.


Steve Yandl


"Desaivres Alain" <DesaivresAlain(a)discussions.microsoft.com> wrote in
message news:2B1106F1-D3E1-4507-B45B-E73F877B0007(a)microsoft.com...
> Hi
>
> Both Excel 2003 and Excel 2007 are installed on a subset of machines
> How to control the object version open when this script line is executed ?
> Set appXL = CreateObject("Excel.Application")
>
> The test on two machines shows that it is the xcel 2003 (version 11.0)
> that
> is opened, the same one you get if you doubleclick on an .xls file while
> neither Excel 2k3 nor Excel 2k7 is opened...
>
> Does it mean there is somewhere a variable that tell to Office which Excel
> to open in case several would be installed ?
>
> Thanks for your help
> Alain
>
>
From: JP on
Try this:

Dim obj1 As Object
Dim obj2 As Object

' open Excel 2003
Set obj1 = CreateObject("Excel.Application.11")

' open Excel 2007
Set obj2 = CreateObject("Excel.Application.12")

--JP


On Mar 18, 9:27 am, Desaivres Alain
<DesaivresAl...(a)discussions.microsoft.com> wrote:
> Hi
>
> Both Excel 2003 and Excel 2007 are installed on a subset of machines
> How to control the object version open when this script line is executed ?
>   Set appXL = CreateObject("Excel.Application")
>
> The test on two machines shows that it is the xcel 2003 (version 11.0) that
> is opened, the same one you get if you doubleclick on an .xls file while
> neither Excel 2k3 nor Excel 2k7 is opened...
>
> Does it mean there is somewhere a variable that tell to Office which Excel
> to open in case several would be installed ?
>
> Thanks for your help
> Alain

From: Desaivres Alain on
Thanks but unfortunately both objects return 12.0 when you query for
objx.Application.version

Alain