Link to home
Start Free TrialLog in
Avatar of jtrawick
jtrawickFlag for United States of America

asked on

Retrieving the Excel file detail "Version number"

I have a spreadsheet that gets updated when features are added or comparison data gets changed. Each time, the "Version number" field in the file properties details gets changed to reflect its configuration. I'd like to put the value of that field in a cell, so that when the spreadsheet is printed, the current version number is on the title page, so that the reviewer can ensure that the current version of the spreadsheet was used.

I'm doing this manually, now, but sometimes I forget and they get out of sync. I could use the Workbook_Open() event to get it and put it into the cell on opening, if I could figure out how to get to the property detail. ThisWorkbook.BuiltinDocumentProperties("Revision Number") works, but it can't find "Version" or "Version number", and Revision wants an integer, not the major.minor string that we're using.

Is there a method/property that does this?
ASKER CERTIFIED SOLUTION
Avatar of Glenn Ray
Glenn Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jtrawick

ASKER

When I run the "set ver" line (3), I get "Run time error 5: Invalid procedure call or argument". I get the same error with ".BuiltinDocumentProperties("Version")"

.BuiltinDocumentProperties("Revision Number") works, but it's not what I need (wrong metadata element).

It seems like it doesn't understand the "Version" index in those collections.

I can set a custom property, but I'd like to use what Excel provides.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<sigh...>

I can set a custom property, but I'd like to use what the OS provides.
Version.png
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.

The spreadsheet uses fairly extensive VBA, and I can count on Windows 7 as the OS and Office 2013. The spreadsheet doesn't get a new version every time, only when the logic or the reference tables are changed. I can set the version in the code, or on the "extended file attributes", but they need to stay synced, so I need to do it in one place. If a create a new variable, it still needs to end up in the "extended file attributes 'Version number'", so I either need to read it or write it, or continue to be very careful (which is not my nature).

Hadn't thought about an OS shell API (now I feel REALLY stupid...) will check in that direction, also. .GetDetailsOf looks promising.
Unfortunately, the .GetDetailsOf appears to only reference the internal BuiltIn or Custom document properties, not OS or NTFS data.

If you have the VBA code that writes the extended file "Version number", I'd use that as a basis for the method of writing that same value to a cell.  Plus, I'd be really interested in seeing that code... :-)
No code - I've been using the right-click to set it (left-click in the box). No idea what that does under the covers.

I went through the first 900 of .GetDetailsOf, no success. 26 of them have data, the last being in index 269, though I can only find descriptions for about 15, Audio/video/picture files have a lot more.

Why does MS make it so hard to get metadata that THEY provide containers for?

I'll let this go for a couple more days, then I'll have to brute-force it. I think I remember liking Microsoft...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry. Been out with the "flu" (doc's opinion, not mine) for a couple of weeks.

This is in accord with my own test. No Joy.

Glenn Ray, thanks for the help in finding that there is no solution. Would like to give you credit for that, but it won't let me click "Assisted Solution" without a "Best Solution".
I believe you can close this question without awarding a solution, but you'll have to check with an admin to find out.

Sorry that I couldn't have been of more assistance.
good comments and code provided by Experts