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.
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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With