Using two versions an Excel automation in the same codeunit

Andreas_LundinAndreas_Lundin Member Posts: 91
edited 2000-10-20 in Navision Financials
Hi all

I have a small question on automation between Excel and Navision.

I have created a codeunit calling Excel using the Excel Object Library(version 9.0 - distributed with Office 2000). But I need to support the version 8.0 of the library as well(distributed with Office 97).

I need to control how to use the codeunit depending on the Excel version on the user machine. If Excel 2000 is istalled, I must use the version 9.0 library, and if Excel 97, the version 8.0.

The automation objects is normally compiled along with the the dataport, and in order to make both work, they must both be registered and compiled. Isn't that correct?

Does anyone have any suggestions how to control the versioning?

Thanks in advance.

Andreas Lundin

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You can use table 2000000046 Automation Servers to look up what Object Library is installed on the customer's PC.

    Write 2 codeunits with your automation code, one for each Excel version. Compile codeunit 1 on a machine with Office97 installed. Compile codeunit 2 on a machine with Office2000 installed.

    Based on the info of table 2000000046, you need to run codeunit 1 or 2. Both codeunits can be included in you automation.fob, but only one will run according to the version of Office which is installed.

    Hope this helps.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • mfabianmfabian Member Posts: 187
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote
    If Excel 2000 is istalled, I must use the version 9.0 library, and if Excel 97, the version 8.0.

    No, you don't need two versions! Luckily enough Versions 8.0 and 9.0 are compatible.
    I am currently developing with the english Excel 2000 while the customer uses German version 97 and even though I don't recompile the Codeunit after installing it at the customers server it works without any problems. It might be that version 9.0 has some added features above version 8.0 but obviously I didn't use any one of them as my Excel interfaces are running smoothly and - believe me - I'm using quite a hell lot of Excel-Functionality.

    To answer your question anyway: The "xlApplication.Version" Property is what you are looking for. You might also consider checking the country code of Excel:

    CountryCode := xlApplication.International(1);

    Marcus


    Marcus Fabian
    m.fabian@thenet.ch
    +41 79 439 78 72
    With best regards from Switzerland

    Marcus Fabian
  • Andreas_LundinAndreas_Lundin Member Posts: 91
    Hi guyz

    Thanks a lot! Your advice did the trick. I'm back on track <img border="0" title="" alt="" src="images/smiles/icon_smile.gif" />

    Regards
    Andreas L.
Sign In or Register to comment.