FSO Properties

  • Thread starter Thread starter Paul Mac
  • Start date Start date
P

Paul Mac

Hi All,

I'm trying to find a way of accessing the document
properties through (FileScriptingObject)FSO. I have
scoured the web & looked in the VBA Help with no luck.

What I would like to be able to do is check the value in
the Document Property -> Title (On the summary tab of the
property window). This will help me find the specific
file in the folder, as the folder may contain three or
four files similar to the search criteria, where only one
will have a specific title.

I realise that this may not be available through FSO, but
somewhere in the object properties of a workbook?

Thanks in advance.

Paul.
 
Hi Paul
put the following code in one of your workbook modules:

Function DocProps(prop As String)
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties (prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function

Now you can use the following formula in one of your cells:
=DocProps("Title")

or use this function within VBA
 
Hey Frank,

I like that function<G>!

Bob

Frank Kabel said:
Hi Paul
put the following code in one of your workbook modules:

Function DocProps(prop As String)
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties (prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function

Now you can use the following formula in one of your cells:
=DocProps("Title")

or use this function within VBA
 
Great Thanks Frank.

Just what I was looking for, who wouldhave thought
BuiltInDcoumentProperties, and not any other logical
combination.

I'll use it in direct code, rather than calling the
function:
Activeworkbook.BuiltInDocumentProperties("Title")

As this will serve mu purpose.

Do you know if you can get it from an FSO state? Or Does
it require the workbook to be open/active

I.e.

set wb = fso.getfile(filelocation)
wb.BuiltInDocumentProperties("Title")

Thanks Again.

P.
 
Hi
don't know for your last questions - try and error :-). I would assume
that it requieres the other WB to be opened
 
It's hardly worth a reference, it's a trivial little thing. One of the best
things about it IMO is the error handling, and that is not exactly new and
revolutionary.

Just enjoyed seeing it.

Bob
 
Paul,

This technique does require the WB to be open.

There is an MS DLL which can access properties without opening the WB.
Haven't used it myself, but if you want to play, you can find it at
http://support.microsoft.com/support/kb/articles/Q224/3/51.ASP
FILE: DSOFILE.EXE Lets You Read Document Properties w/o Office Installed

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top