Results 1 to 7 of 7

Convert range to PDF and save

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    430

    Convert range to PDF and save

    Good Afternoon all

    I'm trying to convert and save a variable range, Worksheet "Data" row "R1: Z" into a PDF file, I have been trying the code below, however when I run it I'm receiving runtime error and message "Document Not Saved" with the last 4 lines of code highlighted in yellow

    Could someone please point out where I am going wrong

    Appreciated

    jim


    Sub SavePDF()
    
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim rng As Range
    Dim Path As String
    Dim FName As String
    
    Set wb = ThisWorkbook
    Set ws = wb.Worksheets("Data")
    Set rng = ws.Range("R1:Z" & Cells(Rows.Count, "R").End(xlUp).Row)
    Path = "H:\Administration\GDP SOP Training\PDF Reports\"
    FName = ws.Range("AD1").Value & " " & Format(Now(), "dd/mm/yyyy  hh:mm") & ".pdf"
    
    rng.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:=Path & FName, _
    IgnorePrintAreas:=True
    
    
    End Sub
    Last edited by JamesT1; 08-16-2023 at 06:02 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Save/convert Excel to Word
    By doylzer in forum Excel General
    Replies: 2
    Last Post: 11-02-2022, 10:27 AM
  2. Convert Range to HTML, then paste to Word, then Save as PDF
    By Lee_of_Excel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-07-2021, 12:28 AM
  3. [VBA] Save Range as picture, save to file, attach to email
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2018, 07:34 AM
  4. [SOLVED] Problems with Vba to save file & convert to PDF
    By si_1970 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2016, 03:32 PM
  5. [SOLVED] VBA - Open Save As dialogue box - to save named range
    By Jabba69 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2014, 10:34 AM
  6. Convert and save as current name
    By martinez77 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-07-2013, 03:09 PM
  7. Convert formulas to values on save
    By Steve B in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2005, 05:25 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