How to put date and file name in the footer

I am trying to put date and file name in the footer of a file exported from access and print it with preset alignment.

What is the code for the date and file name.
Who is Participating?
Saurabh Singh TeotiaConnect With a Mentor Commented:
You can use something like this to do what you are looking for...

Sub putfooter()

    With Sheets("Your Sheet name here").PageSetup
        .CenterFooter = Format(Now(), "mm/dd/yy") & " " & ThisWorkbook.Name
    End With
End Sub

Open in new window

You should be able to use:
for the date.

And you can use:
for the file name.
Jeffrey CoachmanMIS LiasonCommented:
What type of Object are you Exporting?
What format are you exporting it to?
How are you performing the Export (manually or via code)
"and print it with preset alignment."
...Can you explain exactly what this means?

Please be specific.

I will presume by what little info on this you posted, that you want some Access Data exported to Excel?

If so, this can easily be done in a Report.

Create the report from your source data.
In the Report footer insert a textbox control and set the control source to: =Date()
Set the name to: txtDate

Then in the Report footer insert another textbox control but leave the control source blank.
Name this control: txtDBName
Then on the Format event of the Report Footer, put code like this:
    Me.txtPath = CurrentProject.Name

See the attached sample.

Study it carefully and I am sure you will be able to adapt it to work in your database.



Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.