MrExcel Publishing
Your One Stop for Excel Tips & Solutions

File Name Macro


Posted by Bobbi on January 04, 2002 10:35 AM

I want to create a macro that will display the file name and path in the selected cell on a worksheet. I've found a solution that puts it in the footer, which means I can only see it in Print Preview or when I actually print. Is there anyway to do this so I can see it on the screen?


Posted by Tom Urtis on January 04, 2002 10:54 AM

Modify cell of interest as needed:

Sub ID_Path()
ActiveSheet.Range("A1").Value = ActiveWorkbook.FullName
End Sub

HTH

Tom Urtis

Posted by Bobbi on January 04, 2002 11:29 AM

What if I needed to add the save time, date, and user's initials?

Posted by Tom Urtis on January 04, 2002 11:43 AM

Assuming yo mean all in the same cell,

ActiveSheet.Range("A1").Value = ActiveWorkbook.FullName & " " & Date & " " & Time & " " & Application.UserName

HTH

Tom Urtis