Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File properties Radek Simek[_2_] Excel Worksheet Functions 0 December 10th 07 03:45 PM
File Properties TerryTutor Excel Discussion (Misc queries) 2 August 30th 07 06:06 PM
File Properties ALEX Excel Discussion (Misc queries) 1 February 8th 07 02:47 PM
File Properties Annie Excel Discussion (Misc queries) 1 April 20th 06 08:27 PM
Set properties in an XLS file.. S Ayyar Excel Programming 0 December 9th 03 08:51 PM


All times are GMT +1. The time now is 03:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"