+ Reply to Thread
Results 1 to 4 of 4

help with code to save as pdf using cell reference

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    19

    help with code to save as pdf using cell reference

    I want to save a weekly generated report to a shared drive using a cell reference as the file name
    The following code keeps tripping up at the 'Export as PDF line. Can anyone help please.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: help with code to save as pdf using cell reference

    you need to attach a workbook for us to see more easily. i suspect that the value in A5 is not what you think it is, or it is not on the active sheet, or you need to add a filetype when saving

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=fPath & fName &".pdf" , _

    might work

    try puting the below lines in the code before export as pdf

    does it give you what you would expect

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: help with code to save as pdf using cell reference

    How is it 'tripping up'?

    Are you getting errors?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    08-30-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: help with code to save as pdf using cell reference

    Sorry don't know how to attach my file.

    The value in A5 was linked to another cell. I've changed this so A5 is now purely text.

    I've tried your suggestion but it trips over in the same place.

    The code I was using previously works fine. This defined a report name to include the date of the day it is pdf'd. However what we want it to do is give it a name that relates to the data that is in the report (i.e. the text in A5)

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Help - Save As with cell reference
    By devink in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-26-2017, 11:22 PM
  2. Save As new workbook using cell reference
    By Quint6778 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2016, 12:28 PM
  3. Replies: 9
    Last Post: 06-18-2015, 03:12 PM
  4. [SOLVED] save as with current filename plus cell reference text
    By AWITCHER in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-14-2014, 10:00 AM
  5. Macro with cell reference as a name, but prompt for save location and save as csv
    By tomham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 06:21 PM
  6. Code to save as using cell reference
    By TyeReece in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2011, 12:20 PM
  7. Macros to save worksheet based on cell reference
    By JimmiOO in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2009, 01:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1