View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How do I get the file properties?

Guy,

You cannot assume that client will always be index 5. If one of the lower
index properties is deleted, then the rest will take up the gap, thereby
changing index.

Always best to use the name.

--

HTH

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

"Guy Cohen" wrote in message
...
Hi Rob
Thank you for the reply.
I was just about to post that I found it :)
However - my code is a bit different than yours.
I use:
xlsApp.ActiveWorkbook.CustomDocumentProperties(5)
To get the client.
My Excel is in Hebrew so if I reference ("Client") I get an error.
However if I write the Hebrew word for client I get the client OK.

So my new question is- Will "Client" always stay he
CustomDocumentProperties(5)
??

TIA
Guy

‏‏"Rob van Gelder" כתב בהודעה
...
Guy,

Here's an Excel way of doing it.

Sub test()
Dim strSubject As String, strAuthor As String, strClient As String

On Error Resume Next
With ActiveWorkbook.BuiltinDocumentProperties
strSubject = .Item("Subject").Value
strAuthor = .Item("Author").Value
End With
With ActiveWorkbook.CustomDocumentProperties
strClient = .Item("Client").Value
End With
On Error GoTo 0

MsgBox "Subject: " & strSubject & vbNewLine & _
"Author: " & strAuthor & vbNewLine & _
"Client: " & strClient
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Guy Cohen" wrote in message
...
Hi all,

I use VB6 to read/fill an Excel file.
I would like to get the properties of the file.

The fields I need a
From Excel:When you click "File"-"Properties" you have:
Subject + Author on the second tab.
Client on the fifth tab.

Please advise.

Guy