Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I would like to use the values of custom Excel properties in the printed
header. If this isn't possible, can they be displayed in a cell using some formula? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() '----------------------------------------------------------------- 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 and enter in a cell such as =DocProps ("last author") or =DocProps ("last save time") -- __________________________________ HTH Bob "Ed the IT Consultant" <Ed the IT wrote in message ... I would like to use the values of custom Excel properties in the printed header. If this isn't possible, can they be displayed in a cell using some formula? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Change Bob's code to this for Custom Properties
Function CustProps(prop As String) Application.Volatile On Error GoTo err_value CustProps = ActiveWorkbook.CustomDocumentProperties(prop) Exit Function err_value: CustProps = CVErr(xlErrValue) End Function =custprops("Checked By") =custprops("Client") To get a list of all Custom Properties run the following macro. Sub customprops() rw = 1 Worksheets.Add For Each p In ActiveWorkbook.CustomDocumentProperties Cells(rw, 1).Value = p.Name Cells(rw, 4).Value = p.Value rw = rw + 1 Next End Sub Gord Dibben MS Excel MVP On Fri, 20 Feb 2009 17:36:35 -0000, "Bob Phillips" wrote: '----------------------------------------------------------------- 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 and enter in a cell such as =DocProps ("last author") or =DocProps ("last save time") |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
or better yet, combine them
'----------------------------------------------------------------- Function DocProps(prop As String) '----------------------------------------------------------------- Application.Volatile On Error GoTo not_builtin DocProps = ActiveWorkbook.BuiltinDocumentProperties _ (prop) Exit Function not_builtin: On Error GoTo err_value DocProps = ActiveWorkbook.CustomDocumentProperties(prop) Exit Function err_value: DocProps = CVErr(xlErrValue) End Function -- __________________________________ HTH Bob "Gord Dibben" <gorddibbATshawDOTca wrote in message ... Change Bob's code to this for Custom Properties Function CustProps(prop As String) Application.Volatile On Error GoTo err_value CustProps = ActiveWorkbook.CustomDocumentProperties(prop) Exit Function err_value: CustProps = CVErr(xlErrValue) End Function =custprops("Checked By") =custprops("Client") To get a list of all Custom Properties run the following macro. Sub customprops() rw = 1 Worksheets.Add For Each p In ActiveWorkbook.CustomDocumentProperties Cells(rw, 1).Value = p.Name Cells(rw, 4).Value = p.Value rw = rw + 1 Next End Sub Gord Dibben MS Excel MVP On Fri, 20 Feb 2009 17:36:35 -0000, "Bob Phillips" wrote: '----------------------------------------------------------------- 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 and enter in a cell such as =DocProps ("last author") or =DocProps ("last save time") |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Good idea Bob.
Gord On Sat, 21 Feb 2009 12:44:20 -0000, "Bob Phillips" wrote: or better yet, combine them '----------------------------------------------------------------- Function DocProps(prop As String) '----------------------------------------------------------------- Application.Volatile On Error GoTo not_builtin DocProps = ActiveWorkbook.BuiltinDocumentProperties _ (prop) Exit Function not_builtin: On Error GoTo err_value DocProps = ActiveWorkbook.CustomDocumentProperties(prop) Exit Function err_value: DocProps = CVErr(xlErrValue) End Function |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Put something like this in the workbook code area:
Private Sub Workbook_BeforePrint(Cancel As Boolean) v = ThisWorkbook.CustomDocumentProperties("lab1").Valu e ActiveSheet.PageSetup.CenterHeader = v End Sub Replace "lab1" with the name of your custom property. Because it is workbook code, it is very easy to install and use: 1. right-click the tiny Excel icon just to the left of File on the Menu Bar 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (workbook code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200835 "Ed the IT Consultant" wrote: I would like to use the values of custom Excel properties in the printed header. If this isn't possible, can they be displayed in a cell using some formula? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Showing Custom file properties in Header | Excel Discussion (Misc queries) | |||
Can you link a custom property to an Excel custom header text? | Setting up and Configuration of Excel | |||
Excel: custom header - is it possible to paste into header? | Excel Worksheet Functions | |||
How can I using Excel custom document properties in the header? | Excel Worksheet Functions | |||
how do I permanetly add custom header to excel header list? | Excel Discussion (Misc queries) |