link comments section of properties dialog box to footer in Excel

  • Thread starter Forum freak \(at work\)
  • Start date
F

Forum freak \(at work\)

Hi

I use the Comments section in Summary of File Properties quite a lot and
would like to link the contents into the file footer.

I managed this when using Microsoft Word by inserting the field code
{COMMENTS} into the footer then creating a macro to update it on file
closure. Sadly I have not been able to do this with Excel.

I can reference a cell in the footer but cant seem to link the comments
section to a cell - can anyone help?

Regards
Kenny W
XP Pro and Office 2003
 
G

Gary''s Student

Sub Macro1()
s = ActiveWorkbook.BuiltinDocumentProperties.Item(5).Value
ActiveSheet.PageSetup.CenterHeader = s
End Sub
 
F

Forum freak \(at work\)

Thanks Gary that worked a treat.

For future reference is it possible to put the value into a cell?

Regards
Kenny
 
G

Gary''s Student

Sure:

Sub Macro1()
s = ActiveWorkbook.BuiltinDocumentProperties.Item(5).Value
Range("A1").Value = s
End Sub
 
F

Forum freak \(at work\)

Many,many thanks,

Worked perfectly!


Gary''s Student said:
Sure:

Sub Macro1()
s = ActiveWorkbook.BuiltinDocumentProperties.Item(5).Value
Range("A1").Value = s
End Sub
 
G

Gord Dibben

Add this UDF to your workbook.

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

In a cell enter =docprops("Comments")


Gord Dibben MS Excel MVP
 
G

Gord Dibben

In addition, run this macro get a complete list on a new sheet.

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

Or this one to get a list of Custom Properties if you have any.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top