Using VBA to determine what Version of Word is in use

WebGenii
StarLounger
Posts: 58
Joined: 26 Jan 2010, 18:21

Using VBA to determine what Version of Word is in use

Post by WebGenii »

I've never actually had to do this before, but the project I am working requires that I support multiple versions of word in the same template. So I need to determine what version of Word the user is working with.

Now I've snooped around and found that application.version will work - up until Office 2016.
But for Office 2016 and above MS hasn't changed the version number.

Some approaches I found on stack overflow include using the ThisDocument.VBProject.Reference to return information. However, this requires that the trust settings be amended to trust VBA access to the VBA project object model. But I probably won't be able to rely on this setting. And it will rely on parsing the VBA versions, which don't appear obvious (at least I haven't been able to track anything for which vba versions map to which versions of word).

So, have I exhausted all the obvious avenues? Any suggestions before I shrug and lump Office 2016-365 together? It seems so untidy somehow.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Using VBA to determine what Version of Word is in use

Post by HansV »

It's a mess, since Microsoft uses the same build numbers for Office 2016 and Office 2019 (which get only security updates) and Microsoft 365 (which gets feature updates). So Application.Build doesn't help either.
In fact, the files are the same - Microsoft turns features on or off depending on the license key...

See Check the application version in Modern Office for an alternative.
Best wishes,
Hans

WebGenii
StarLounger
Posts: 58
Joined: 26 Jan 2010, 18:21

Re: Using VBA to determine what Version of Word is in use

Post by WebGenii »

Thanks!