I have two versions of excels(2010 and 2016) installed on my machine. I would like to run a vbscript on excel 2016.
However, the
CreateObject("Excel.Application")
only creates excel 2010. How can i change this to 2016?
I have two versions of excels(2010 and 2016) installed on my machine. I would like to run a vbscript on excel 2016.
However, the
CreateObject("Excel.Application")
only creates excel 2010. How can i change this to 2016?
For 2016, you could try CreateObject("Excel.Application.16")
.
However, see the comments below as this is not guaranteed to work for recent versions. This has worked for me before for versions up-to and including 2010.
Note that earlier versions don't have such a straightforward correspondence, 2016 => 16. For example, I believe Office 2010 => 14.
Excel.Application.9
loads Excel 2000, Excel.Application.10
loads Excel 2002 and Excel.Application.11
loads Office Excel 2003)... –
Murguia I believe the issue you may be running into is of 32bit and 64bit.
32bit: c:\Windows\SysWOW64\wscript.exe
64bit: c:\Windows\System32\wscript.exe
When you run a 32bit vbscript process (the default) the mapping automatically takes the 32bit excel version.
So you should try running it with the 64bit VBScript
And yes you would want to use CreateObject("Excel.Application.16")
SysWOW64
is for 32-bit processes. 64-bit processes are stored in system32 –
Murguia © 2022 - 2024 — McMap. All rights reserved.