ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to add a modified date in header(excel)? (https://www.excelbanter.com/excel-discussion-misc-queries/15331-how-add-modified-date-header-excel.html)

Thanga

How to add a modified date in header(excel)?
 
I need to get in header the date when the excel document have last modified.
I tried using &[Date] this brings the current date when we open the doc.

Kindly suggest good way of doing this.

Bob Phillips

Private Sub Workbook_BeforePrint(Cacel As Boolean)
With ActiveWorkbook
.ActiveSheet.PageSetup.LeftHeader = "Last saved on: " & _
Format(.BuiltinDocumentProperties("Last Save Time"), "dd mmm
yyyy")
End With
End Sub


goes in the ThisWorkbook code module.


Watch the wrap-around on the Format line


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Thanga" wrote in message
...
I need to get in header the date when the excel document have last

modified.
I tried using &[Date] this brings the current date when we open the doc.

Kindly suggest good way of doing this.




Thanga

HI Bob,
Thanks for the reply.
But the function does't work it gives and error. Kindly check it and let me
know the updated function.

Once again thanks for ur effort.

Regards
Thanga

"Bob Phillips" wrote:

Private Sub Workbook_BeforePrint(Cacel As Boolean)
With ActiveWorkbook
.ActiveSheet.PageSetup.LeftHeader = "Last saved on: " & _
Format(.BuiltinDocumentProperties("Last Save Time"), "dd mmm
yyyy")
End With
End Sub


goes in the ThisWorkbook code module.


Watch the wrap-around on the Format line


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Thanga" wrote in message
...
I need to get in header the date when the excel document have last

modified.
I tried using &[Date] this brings the current date when we open the doc.

Kindly suggest good way of doing this.





Bob Phillips

I did say to watch the wrap-around. The yyyy") should be on the same line as
the Format.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Thanga" wrote in message
...
HI Bob,
Thanks for the reply.
But the function does't work it gives and error. Kindly check it and let

me
know the updated function.

Once again thanks for ur effort.

Regards
Thanga

"Bob Phillips" wrote:

Private Sub Workbook_BeforePrint(Cacel As Boolean)
With ActiveWorkbook
.ActiveSheet.PageSetup.LeftHeader = "Last saved on: " & _
Format(.BuiltinDocumentProperties("Last Save Time"), "dd mmm
yyyy")
End With
End Sub


goes in the ThisWorkbook code module.


Watch the wrap-around on the Format line


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Thanga" wrote in message
...
I need to get in header the date when the excel document have last

modified.
I tried using &[Date] this brings the current date when we open the

doc.

Kindly suggest good way of doing this.







Thanga

Thanks it works. It was because of the extra "

Regards
Thanga

"Thanga" wrote:

I need to get in header the date when the excel document have last modified.
I tried using &[Date] this brings the current date when we open the doc.

Kindly suggest good way of doing this.



All times are GMT +1. The time now is 02:15 PM.

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