How to programmatically distinguish Excel 2019 from 2016

0 votes

I keep a diagnostic that automatically determines the MS Office version, including Word and Excel. Versions of MS Office 2003, 2007, 2010, 2013, and 2016 have all run smoothly with it. However, I've since discovered that it incorrectly lists MS Office 2019 applications as MS Office 2016.

Here is a VB Script that diagnoses which, if any, version of Excel is installed to the system:

On Error Resume Next
Set excelApp = CreateObject("Excel.Application") 
If Err.Number <> 0 Then
    WScript.Echo "Excel is not installed"
Else
    Wscript.Echo "Excel Version: " & excelApp.Version 
End If

The diagnostic faithfully reports MS Office versions consistent with the post from 2011. Since then, it reports 15.0 for Office 2013, and 16.0 for Office 2016. Recently, though, I was surprised to find that it also reports 16.0 for Office 2019. That is just not right! The 2016 and 2019 feature sets are clearly distinct, so they should not be lumped together.

Is there an alternate way to programmatically distinguish Office 2016 from Office 2019?

Nov 11, 2022 in Others by Kithuzzz
• 38,000 points
509 views

1 answer to this question.

0 votes

Using the output of the MS Office Client Software License Management Tool, OSPP.VBS, ran with the /dstatus option, one can circumvent the issue. Here is an example CMD script that exemplifies the fix:

:: GetOfficeVer.cmd - Print the version of a licensed MS Office package.
::   Prerequisite:
::      Copy this cmd script to a folder including these MS Office files:
::          * OSPP.VBS    - MS Office Software Protection Platform script.
::          * OSPP.HTM    - Help file for OSPP.VBS.
::          * SLERROR.XML - Data file for OSPP.VBS.
::   Syntax:
::      GetOfficeVer [ComputerName[ PackageAbbr]]
::        ComputerName    - Windows system name  (defaults to local system)
::        PackageAbbr     - Package abbreviation (list below is not exhaustive)
::          *  ProPlus    - Office Professional Plus (default)
::          *  VisioPro   - Visio Professional
::          *  InfoPath   - InfoPath Designer
::   Return Values:
::          *  If the package is licensed, print the MS Office package version
::             string using the MS Office Application.Version property format.
::          *  If the package is unlicensed, print an empty line.
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
if %2_==_ (set MSO_PKG=ProPlus) else (set MSO_PKG=%2)
set "MSO_PKG_LIC=cscript "%~dp0\OSPP.VBS" /dstatus %1 | findstr /R /C:"^LICENSE NAME:.*%MSO_PKG%""
for /f "tokens=1-4 delims=, " %%G in ('!MSO_PKG_LIC!') do (set MSO_VER=%%J)
if %MSO_VER%_==_ (echo.) else ( echo %MSO_VER%.0)
endlocal
answered Nov 11, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
1 answer

How to import data from a HTML table on a website to excel?

Hello  To import any HTML file in excel there ...READ MORE

answered Feb 10, 2022 in Others by gaurav
• 23,260 points
7,972 views
0 votes
1 answer

How to convert data from txt files to Excel files using python

Hi , there are few steps to ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
14,045 views
0 votes
1 answer

How to open .xlsx files in MS Excel from VS Code?

Hello, to open xlxs files, or files ...READ MORE

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
4,246 views
0 votes
1 answer

Excel: How to merge two columns into one (from different sheets or separated columns)

This equation is completely adjustable. Your two ...READ MORE

answered Oct 7, 2022 in Others by narikkadan
• 63,600 points
880 views
0 votes
1 answer

Word Mail Merge with Excel data has to be saved in different files with custom names

Try this: Public Sub Mail_Merge() On Error GoTo ErrH Dim ...READ MORE

answered Nov 6, 2022 in Others by narikkadan
• 63,600 points
1,811 views
0 votes
1 answer

Add .xll as AddIn to Excel

Hi, for adding an xll as Addln ...READ MORE

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
1,215 views
0 votes
1 answer

JavaScript API does not work for Excel 2013?

Each method in the Office.js APIs is ...READ MORE

answered Sep 26, 2022 in Others by narikkadan
• 63,600 points
790 views
0 votes
1 answer

How to Paste JPEG as a gif in excel?

Solution  Step 1 Navigate to the folder that contains ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 63,600 points
751 views
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,600 points
1,397 views
0 votes
1 answer

How can I convert excel to PDF by Libreoffice and keep all format from excel file?

"Times New Roman" typeface does not have ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,600 points
1,673 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP