Using two versions an Excel automation in the same codeunit

Andreas_Lundin
Member Posts: 91
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
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
0
Comments
-
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)0 -
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quoteIf 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 72With best regards from Switzerland
Marcus Fabian0 -
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions