reading custom properties from a closed file

lalbatros

Well-known Member
Joined
Sep 5, 2007
Messages
659
I would like to read a few custom properties of excel workbook, even if they are close.
My intention is to build a list of compatible workbooks.
The compatibility woul be determined fom a custom property.

How can I read a custom property from a file wothout opening it?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Richard,

I think this is possible.
In the windows explorer you can read the custom properties by a right-click / properties,
and the file wil not be opened.
 
Upvote 0
Could you explain what it is that you want to know about the file - there are some properties accessible via the FileSystemObject, and perhaps these could be of use to you.
 
Upvote 0
In the custom tab for the file properties, it is possble to add any number of custom properties.
You simply need to define a name, a type and a value.

My intention is to identify some kind of workbooks by some custom properties.
Maybe these properties will be set manually, or eventually they will be set automatically by the application.

The second step is to be able to read these custom properties from any workbook.
The goal is simply to create a kind of specialized scenario management.
All file from the same series of scenario would share a same custom property (setName).

In addition, all files related to this application would also share a common custom property.
In this way it is be easier create file selection screens where only the relevant files appear.
 
Upvote 0
You can if you have the dsofile.dll - see here for details.
HTH
 
Upvote 0
Well, i need to eat my hat because you would appear to be correct! I'll be honest with you I have no idea how to access those from a closed file - I don't even know how to write them to an open file. Time for me to try the macro recorder and see if that spots them.

EDIT: Ah, glad Rory dropped by - so now we know :-)
 
Upvote 0
rorya ,

Would there be a way to do it without dsofile?
What is inside dsofile that could not be written in plain VBA?

My concern is to keep distribution of my application as simple as possible.
 
Upvote 0
What is inside dsofile that could not be written in plain VBA?
As I didn't write dsofile, I have no idea what's in there, other than a bunch of C++ to work with compound objects! There may or may not be equivalent API functions that you can use from VBA, but just because something is possible for Microsoft, doesn't mean it's available to you as a VBA developer. In that article, you will note the section that reads:
"To help developers that are interested in reading document properties, we have provided the following two interfaces to manage property sets: <TABLE class="list ul"><TBODY><TR><TD class=bullet>•</TD><TD class=text>IPropertySetStorage</TD></TR><TR><TD class=bullet>•</TD><TD class=text>IPropertyStorage</TD></TR></TBODY></TABLE>However, some high-level programming languages may have trouble using these interfaces because the interfaces are not Automation-compatible. To resolve this problem, developers can use an ActiveX DLL, such the "DsoFile sample" to read and to write the most common properties that are used in OLE compound documents. This applies particularly those that are used by Microsoft Office applications."
 
Upvote 0
Thanks rorya,

This illustrates very well and simply the historical evolution of the MS technology and the complexity it creates. Now in this .net period we tend to forget the technological wandering at the times of OLE and COM and even before.

I am still unable to tell what OLE and COM is, and I ignore totally what is behing the scene of .net, or even what .net actually is.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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