ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Links and Linking in Excel (https://www.excelbanter.com/links-linking-excel/)
-   -   Embedding file name in a Cell (https://www.excelbanter.com/links-linking-excel/542-embedding-file-name-cell.html)

Mark Sowerbutts

Embedding file name in a Cell
 
Anyone know how to link / write the excel spreadsheet file name into a cell
in the actual spreadsheet?
I know you can do it in the header / footer ... that's not what I need.

Also, how about the "Last Printed" or "Last Saved" date saved to a cell in
the spreadsheet.

Thanks,
Mark



JE McGimpsey

Take a look he

http://www.mcgimpsey.com/excel/formu..._function.html


In article ,
"Mark Sowerbutts" wrote:

Anyone know how to link / write the excel spreadsheet file name into a cell
in the actual spreadsheet?
I know you can do it in the header / footer ... that's not what I need.


JE McGimpsey

You'd need to use VBA. Put these in your workbook code module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Range("A1")
.Value = Date
.NumberFormat = "dd mmm yyyy"
End With
End Sub

Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Range("A1")
.Value = Date
.NumberFormat = "dd mmm yyyy"
End With
End Sub

adjust the range reference as desired. Note that this will put the date
in even if the user cancels the save or print.

If you're new to macros, see David McRitchie's "Getting Started with
Macros":

http://www.mvps.org/dmcritchie/excel/getstarted.htm


In article ,
"Mark Sowerbutts" wrote:

Also, how about the "Last Printed" or "Last Saved" date saved to a cell in
the spreadsheet.



All times are GMT +1. The time now is 11:52 PM.

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