0

I'm using IBM Personal Communications emulator to run a macro which launches an Excel application.

set appExcel = CreateObject("Excel.Application")
appExcel.Visible = true
set appWB = appExcel.workbooks.Open("LINK")
Set appWS = appWB.Sheets("Sheet1")

It opens up everything in Excel 2016 by default. Is it possible to specify the version of Excel that will be opened up in Visual Basic?

braX
  • 11,506
  • 5
  • 20
  • 33
smgrd
  • 25
  • 5
  • 1
    I am not 100% sure... but I believe that you can use "Excel.Application.NN" (where NN is the version number of Excel you want to start). Open Regedit in Windows, browse to HKEY_CLASSES_ROOT and scroll down to "Excel.Application" to see what versions that are available to you – Gowire Aug 26 '20 at 10:37
  • 2
    Does this answer your question? [VBScript create excel 2016 object](https://stackoverflow.com/questions/48324720/vbscript-create-excel-2016-object) *(talks about using different versions)* – user692942 Aug 26 '20 at 10:38
  • 1
    This [answer](https://stackoverflow.com/a/2241855/692942) goes into a bit more detail. – user692942 Aug 26 '20 at 10:41
  • Here's an [old copy of the Microsoft Support article](https://www.dyalog.com/uploads/conference/dyalog08/presentations/W12_Procter_Automation/html/multipleofficeversions.htm), the interesting bit - *"A common perception for Office Automation when you have multiple versions of Office installed on a system is that you can dictate which version loads by using a specific version-dependent PROGID. However, **this is not correct**. Excel 2000, 2002, and 2003 share the same CLSID, so the version that loads with these PROGIDs **depends solely on which version was last installed**."*. – user692942 Aug 26 '20 at 10:44
  • Please, tell us what other versions do you have installed? Are all of them versions bigger then 16? – FaneDuru Aug 26 '20 at 10:58
  • Thanks for the responses. It seems that the emulator only supports the 32-bit version of Excel. I've got the 64-bit one installed and it just uses an older 32-bit version automatically. – smgrd Aug 26 '20 at 10:58
  • I need Excel 365 to be used automatically, which apparently is impossible without changing to 32-bit Excel on my PC. – smgrd Aug 26 '20 at 11:00
  • Please, tell us what other versions do you have installed? Are all of them versions bigger then 16? I am using such an approach in order to open Corel Draw different versions and it works without any problem "Corel.Application.xx" (as @Gowire suggested). I understood that it works for Office, too, starting from version 14 (Excel 2010). Regarding 32 bit installation, it may be related to the default installation... When you (manually) try opening any workbook, what version is used? – FaneDuru Aug 26 '20 at 11:04
  • I would also suggest to manually open the 64 bit version and then use `set appExcel = GetObject(,"Excel.Application")`. Only to check if it is able to work with this version, too. I think it should... – FaneDuru Aug 26 '20 at 11:08
  • No, they are not all bigger than 16. I need to use functionality that is only supported by Excel 365. So I need Excel 365 to be launched from the emulator. The emulator does not support 64-bit – smgrd Aug 26 '20 at 11:18
  • Ar you sure that "The emulator does not support 64-bit"? Did you try my last suggestion, involving `GetObject`? Note: If you do not tag me (@FaneDuru), I am not notified about any of your comment. Now, it happened I came here to see what's happening.. – FaneDuru Aug 26 '20 at 11:29
  • @FaneDuru Kind of already gone over this. The Microsoft Article I linked states it clearly - *" However, this is not correct. Excel 2000, 2002, and 2003 share the same CLSID"*. It might work for Corel but their not Microsoft, it would make sense for the ProgID version to control the COM object instance you are accessing but unfortunately, Microsoft in their infinite wisdom decided to take a huge dump on that approach. – user692942 Aug 26 '20 at 15:45
  • @Lankymart: Understood that, but the only fact which matter should be that IBM Personal Communications emulator is able to work with 64 bit version... If yes, I had in mind a workaround: To open a file in the default Excel version installation, supposing that it is the 64 bit version and then grab the session using `GetObject` instead of `CreateObject`... – FaneDuru Aug 26 '20 at 16:59
  • @FaneDuru IBM PCOMM 6.0 is not able to work with the 64 bit version. – smgrd Aug 27 '20 at 07:03
  • @smgrd: OK. If this is what it is able to do, then anything else then 23 bit cannot be explored. I didn't know that. – FaneDuru Aug 27 '20 at 07:33
  • @FaneDuru 23 bit, new one on me. ;) – user692942 Aug 28 '20 at 15:23

0 Answers0