ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I print Excel file properties information? (https://www.excelbanter.com/excel-discussion-misc-queries/199090-how-do-i-print-excel-file-properties-information.html)

Andy Holm

How do I print Excel file properties information?
 
I would like to print Excel file properties like it is possible to do for
Word documents to show date created, saved, etc. Is there a way to do this?
Thanks for the help.

Gord Dibben

How do I print Excel file properties information?
 
Andy

With some code you can get the built-in Document Properties.

I don't know how extensive "etc" is but if you want to print out Custom
Properties also that would take much more code.

For built-ins you can use this UDF

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

'=DOCPROPS("author")
'or
'=DOCPROPS("last save time")
'or
'DOCPROPS("creation date")

To get a list of all available built-ins on a new sheet run this macro.

Sub documentprops()
'list of properties on a new sheet
rw = 1
Worksheets.Add
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 1).Value = p.Name
Cells(rw, 4).Value = "=DocProps(" & "A" & rw & ")"
rw = rw + 1
Next
End Sub


Gord Dibben MS Excel MVP

On Sat, 16 Aug 2008 07:46:01 -0700, Andy Holm <Andy
wrote:

I would like to print Excel file properties like it is possible to do for
Word documents to show date created, saved, etc. Is there a way to do this?
Thanks for the help.



Mike H

How do I print Excel file properties information?
 
Hi,

Right click the sheet tab where you want the report, view code and paste
this an run it

Sub Properties()
x = 1
Cells(x, 1).Value = "Properties"
x = x + 1
For Each p In ActiveWorkbook.BuiltinDocumentProperties
On Error Resume Next
Cells(x, 1).Value = p.Name
Cells(x, 2).Value = p.Value
x = x + 1
Next
On Error GoTo 0
End Sub


Miek

"Andy Holm" wrote:

I would like to print Excel file properties like it is possible to do for
Word documents to show date created, saved, etc. Is there a way to do this?
Thanks for the help.


Mike H

How do I print Excel file properties information?
 
Gord

....if you want to print out Custom
Properties also that would take much more code.


Unless I'm missing something for Custom properties don't you simply
substitute this
in my answer

For Each p In ActiveWorkbook.BuiltinDocumentProperties

with this

For Each p In ActiveWorkbook.CustomDocumentProperties

Mike


"Gord Dibben" wrote:

Andy

With some code you can get the built-in Document Properties.

I don't know how extensive "etc" is but if you want to print out Custom
Properties also that would take much more code.

For built-ins you can use this UDF

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

'=DOCPROPS("author")
'or
'=DOCPROPS("last save time")
'or
'DOCPROPS("creation date")

To get a list of all available built-ins on a new sheet run this macro.

Sub documentprops()
'list of properties on a new sheet
rw = 1
Worksheets.Add
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 1).Value = p.Name
Cells(rw, 4).Value = "=DocProps(" & "A" & rw & ")"
rw = rw + 1
Next
End Sub


Gord Dibben MS Excel MVP

On Sat, 16 Aug 2008 07:46:01 -0700, Andy Holm <Andy
wrote:

I would like to print Excel file properties like it is possible to do for
Word documents to show date created, saved, etc. Is there a way to do this?
Thanks for the help.




Gary''s Student

How do I print Excel file properties information?
 
How about this macro:

Sub Macro1()
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.CenterHeader = ""
.LeftHeader = ""
i = 1
For Each wp In ActiveWorkbook.BuiltinDocumentProperties
If i = 12 Or i = 11 Then
On Error Resume Next
.CenterHeader = .CenterHeader & wp.Name & " " & wp.Value &
Chr(10)
End If
i = i + 1
Next

End With
End Sub

--
Gary''s Student - gsnu200800


"Andy Holm" wrote:

I would like to print Excel file properties like it is possible to do for
Word documents to show date created, saved, etc. Is there a way to do this?
Thanks for the help.



All times are GMT +1. The time now is 07:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com