Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I get the file properties?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I get the file properties?
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I get the file properties?
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I get the file properties?
Guy,
It's not in position 5 on my computer... which raises an interesting problem. Looks like if you want to use both, you may have to do lanuage checks up front. -- Rob van Gelder - http://www.vangelder.co.nz/excel "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File properties | Excel Worksheet Functions | |||
File Properties | Excel Discussion (Misc queries) | |||
File Properties | Excel Discussion (Misc queries) | |||
File Properties | Excel Discussion (Misc queries) | |||
Set properties in an XLS file.. | Excel Programming |