Solved

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

Posted on 2014-10-08
1
95 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

706 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

19 Experts available now in Live!

Get 1:1 Help Now