0

I have 2 excel versions installed on my system. 2007 and 365.

when using

function open1()

set h = createobject("Excel.application")
h.visible = true
h.workbooks.add

end function

Excel 365 opens up. When I wanted to open excel 2007.

I tried searching for solution for this. but could not find any similar case.

Is there any specific way by which I can particularly open excel 2007 application?

Fennekin
  • 216
  • 3
  • 12
  • There is no way to do that using `CreateObject` that I know of. It will just redirect to whatever the default version is. You'd need to use `Shell` and then find another way to get a reference to the application in question. – Rory Jan 12 '23 at 15:26
  • that is for excel 10. – Fennekin Jan 12 '23 at 16:50

1 Answers1

0

Try the next adapted way. No need to be function, if it does not return anything:

Sub open1()
  dim h as Object

  set h = createObject("Excel.application.12")
  h.visible = true
  h.workbooks.add
end Sub

For the other version try using createObject("Excel.application.16"). Otherwise, the default version is automatically chosen...

I cannot test it, since I never needed two different versions. But I did that with Corel versions, which works in this way. In Corel case there are some differences between the versions in terms of differently doing the same thing. I developed some applications and I needed to update all of them in case of required modifications.

FaneDuru
  • 38,298
  • 4
  • 19
  • 27