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?

2
  • 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. Commented Jan 12, 2023 at 15:26
  • that is for excel 10. Commented Jan 12, 2023 at 16:50

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Still opens excel 365

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.