MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro to auto write complete path to footer of workbook


Posted by Manu on February 07, 2001 10:30 AM

I am looking for a macro or a utility that will auto write complete path name to a workbook when the workbook is saved. This would make it easier to access the specific workbook.

Your help is appreciated.

Manu


Posted by Dave Hawley on February 07, 2001 9:17 PM

Hi Manu

Right click on the sheet picture top left next to "File" and select "View Code". now paste in this code:


Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Dim Sht As Worksheet

For Each Sht In ActiveWorkbook.Worksheets
Sht.PageSetup.LeftFooter = Me.FullName
Sht.DisplayPageBreaks = False
Next
End Sub


Push Alt+Q to get back to Excel.


Hope this helps
OzGrid Business Applications

Posted by Manu on February 09, 2001 10:12 AM

Thanx a million Dave, it worked and is going to save me so much hassle.

A question though, will this apply to any workbook that is opened and saved or will this have to be pasted each time for it to work

Posted by Dave Hawley on February 09, 2001 8:05 PM

A question though, will this apply to any workbook that is opened and saved or will this have to be pasted each time for it to work : Hi Manu : Right click on the sheet picture top left next to "File" and select "View Code". now paste in this code


Hi Manu

Glad it helped! the above macro will need to be placed in each Workbook. If you want to have this in ALL workbooks you will need to place it in a normal module within your Personal Macro Workbook and either set a shortcut keyto run it or attach it to a button

Dave

OzGrid Business Applications