Excel range to PDF

Posted on 2012-09-06
Last Modified: 2012-09-07
I'm trying to export a range from an excel spreadsheet to My Documents in PDF format.
The range contains a number of charts. I have tried a few variations of the following code to no avail;

Range("SummaryChart").ExportAsFixedFormat 0, "C:\Documents" & Range("F1").Value & ".pdf", 0

(Range F1 contains the name I would like the file to be named as)
Any advice is appreciated.
Question by:Stephen Byrom
    LVL 18

    Accepted Solution

    Does this

    Range("SummaryChart").ExportAsFixedFormat 0, "C:\Documents\" & Range("F1").Value & ".pdf", 0

    Open in new window

    help you ?
    LVL 1

    Author Comment

    by:Stephen Byrom
    Thanks for the response.
    Apart from the backslash after the word "Documents" it isn't really that much different, but I'm afraid it still throws up an error.I'm using Excel 2010 if that's significant.
    LVL 1

    Author Closing Comment

    by:Stephen Byrom
    I managed to work around the error. I simplified the string expression in F1 (made it shorter really) and it worked fine.
    Thanks for your time

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
    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…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now