Identify What Version of Excel is Installed

bisel

Active Member
Joined
Jan 4, 2010
Messages
262
Office Version
  1. 365
Platform
  1. Windows
I have a need to determine if the user's installed version of Excel will support specific features. Upon opening a workbook, I am trying to collect information ...
  • The Excel Version number
  • The Excel Product Code
  • The Excel Build Number
  • The Operating System identifier

I am using the following in a macro that runs when the user opens the workbook ...

Rich (BB code):
Sub checkexcel()
     Dim excelname as String
Dim excelVersion As String​
Dim excelBuild As String​
Dim excelProductCode As String​
Dim osp As String​
excelname = Application.Application excelVersion = Application.Version​
excelBuild = Application.Build excelProductCode = Application.productCode osp = Application.OperatingSystem end sub

When I run the macro, I get the following results:

Application.Application = Microsoft Excel
Application.Version = 16.0
Application.Build = 18324
Application.ProductCode = {90160000-000F-0000-1000-0000000FF1CE}
Application.OperatingSystem = Windows (64-bit) NT 10.00

I am hoping to be able differentiate between Excel 2016, 2019, 2021, 2024 and 365. But all these have Application.Version = 16.0

Looking into the build numbers and I am finding similar problems. That is, I cannot find a reference of build numbers that differentiate between Excel's. Perhaps there is such a thing, but I cannot find them. Lastly, my PC is running Windows 11, but Application.OperatingSystem yields the result shown above.

Does anyone have a solution on how I can perform the query upon opening an Excel Workbook to obtain the details I am looking for?

Thanks,

Steve
 
Last edited by a moderator:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Answering an either/or question with 'Yes' isn't particularly illuminating. ;)
Hello Rory,

It is my understanding that the insert image in the cell and the IMAGE function were introduced in Excel 365 at the same build. There is a difference in that the insert image in cell is available using the ribbon menu or by right clicking on the image/cell and selecting insert in cell or place over the cells. The IMAGE function allows a person to create a formula and specify things such the source and size.

My thought is to attempt to use the IMAGE function in a VBA macro and then trap the error that may be generated if the user's version of Excel does not support the IMAGE function. In that manner I might be able to assume that they also could not use the place image in a cell feature either.

Steve
 
Upvote 0
I am probably old fashioned but my first reaction is to build something that works on all systems.
But then I don't know how important it is to have a picture inside a cell on one system and on top of the cell in another system.
I think it was Mr Hawley (RIP) who advocated KISS
Your suggestion is valid and I am making changes to accommodate the user to use either method ... that is, if their version of Excel does not support image in cell, then use the the old method of placing the image over the cells. The caveat to the user would then state that they will not be able to sort/filter the table and retain the association of the images.

Regards,

Steve
 
Upvote 0
My thought is to attempt to use the IMAGE function in a VBA macro and then trap the error that may be generated if the user's version of Excel does not support the IMAGE function. In that manner I might be able to assume that they also could not use the place image in a cell feature either.

Steve
You could also use CallByName and attempt to use the Insertpictureincell method of a Range. If that causes a 438 error, then the version doesn't support it.
 
Upvote 0
You could also use CallByName and attempt to use the Insertpictureincell method of a Range. If that causes a 438 error, then the version doesn't support it.
Hi Rory,

I am not familiar with CallByName to do this, but it seems like a great idea. Do you have more information about how I might go about this?

Thanks,

Steve
 
Upvote 0
If you use something like:

VBA Code:
On Error Resume Next
CallByName Range("A1"), "Insertpictureincell", VbMethod, "C:\testing\some pic.png"
if err.number = 438 then
   msgbox "Functionality is not supported in your version!"
end if

You will see the message if that method is not available. Note that you have to use a valid picture file unfortunately, otherwise you get an error message that is not handled by the On Error statement for some reason.
 
Upvote 0
If you use something like:

VBA Code:
On Error Resume Next
CallByName Range("A1"), "Insertpictureincell", VbMethod, "C:\testing\some pic.png"
if err.number = 438 then
   msgbox "Functionality is not supported in your version!"
end if

You will see the message if that method is not available. Note that you have to use a valid picture file unfortunately, otherwise you get an error message that is not handled by the On Error statement for some reason.
Hi Rory,

The only issue with the VBA is that if the function is supported, then the image is placed inside the cell. However, the next time the file is opened, the named image will no longer be available and will therefore result in an error. Of course the use of "On Error Resume Next" statement will allow the macro to proceed but then I would lose the ability to check if the function is supported.

I thought about first inserting the image in the cell and then select the cell and then place a statement to place image over cells. This works, but then Excel names the image (Picture nn) and I lose the ability to run that routine a second time as the named image no longer has the original name.

I wish I could merely find a reliable way to identify the product name, version and build number to lookup in a table if the ability to insert into a cell is supported. As I mentioned earlier, I believe the "insert image in a cell" capability was introduced with Excel 2024 and Excel 365. I believe the build number is #16529 for both Excel 2024 and Excel 365. But unless I can reliably obtain the product information, using the build number only may not yield good results when I attempt to validate the user's version of Excel. According to MS support website, the ability to insert pictures directly into Excel cells started with Version 2306 ... my understanding is that translates to June 2023.

I may be worrying about this unnecessarily as I have found performing Google searches that the insert picture in a cell is available on Excel 2016, 2019, 2021, 2024 and 365 using the ribbon menu or the IMAGE function. The question then becomes if that function was made available in versions greater than 2306. Which would equate to Version 16 if one uses the Application.Version command. Version 16 applies to all Excel 2016 and after. So maybe all I need is to test the build number ???
 
Upvote 0
It feels like you missed the point. A 438 error means specifically that the method is not supported. Any other error number would mean some other problem.
 
Upvote 0
Hello Rory,

It is my understanding that the insert image in the cell and the IMAGE function were introduced in Excel 365 at the same build. There is a difference in that the insert image in cell is available using the ribbon menu or by right clicking on the image/cell and selecting insert in cell or place over the cells. The IMAGE function allows a person to create a formula and specify things such the source and size.

My thought is to attempt to use the IMAGE function in a VBA macro and then trap the error that may be generated if the user's version of Excel does not support the IMAGE function. In that manner I might be able to assume that they also could not use the place image in a cell feature either.

Steve

I posted something like this in Post #9 in this thread. It attempts to place the image and checks to see if it returned a NAME error or not and then deletes the content of that cell. I picked cell IV2 because that's usually out of the range that people would see.
 
Upvote 0
It feels like you missed the point. A 438 error means specifically that the method is not supported. Any other error number would mean some other problem.
Hi Rory,

Ahh ... so you are saying that the use of the command in a VBA macro would not actually place a named image inside a cell, it would merely check to see if the method was supported. Is that correct?

Steve
 
Upvote 0

Forum statistics

Threads
1,226,527
Messages
6,191,570
Members
453,665
Latest member
WaterWorks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top