Solved

How to write VBA code to add date into a PDF file footer

Posted on 2014-10-08
1
97 Views
Last Modified: 2014-10-09
I created a button to let users to save the Excel workbook to a PDF file.  Now the users asked to add the version number of the workbook and the saving date into the PDF file.  Can you help me on this?
0
Comment
Question by:jjxia2001
1 Comment
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40369474
This excerpt of code could be added before the print method to add a date on the left footer and  version number on the right footer.
    'add to definitions
    Dim strVersion As String

    'Assign version number in code
    strVersion = "1.0.A"
    
    'Insert before Print method
    With ActiveSheet.PageSetup
        .LeftFooter = "&D"
        .CenterFooter = ""
        .RightFooter = "&F - Version " & strVersion
    End With

Open in new window


You'll need to assign the version number in your existing code, this is just an example.

Regards,
-Glenn
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now