+ Reply to Thread
Results 1 to 5 of 5

Macro save a range to PDF

  1. #1
    Registered User
    Join Date
    08-11-2015
    Location
    Teesside
    MS-Off Ver
    Professional 2013
    Posts
    14

    Macro save a range to PDF

    Hi

    Can anyone assist please. I had a Macro to save a range to PDF see below, but for some reason it is now not working See below. TIA

    Sub SavePDF()


    ActiveSheet.Unprotect ("PFS123")
    .ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:="N:\pdf purchase orders" " & Range("F4").Value & ".pdf",
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=True '
    ActiveSheet.Protect ("PFS123")
    End Sub

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Macro save a range to PDF

    .
    Untested here :

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-11-2015
    Location
    Teesside
    MS-Off Ver
    Professional 2013
    Posts
    14

    Re: Macro save a range to PDF

    Hi

    Thanks for the response it still doesn't work, Could it be that i also have a range to print this document on another macro? My range is called Myrange2.

    I appreciated with the given information that you cannot test it.

    Thank you.
    Attached Files Attached Files
    Last edited by Carolbell44; 07-26-2020 at 12:50 PM. Reason: Upload a file

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Macro save a range to PDF

    .
    This worked here with the change path for my computer :

    Please Login or Register  to view this content.
    Note that I commented out the UNPROTECT and PROTECT lines of code.

    You should be able to change the path back to your system ( "N:\pdf purchase orders\" & Range("F4").Value & ".pdf" ) and run the macro. I do not
    see any reason why it would not work.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Macro save a range to PDF

    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. Print/Save to .pdf using a Macro that references a range/cell
    By WithinTheLight in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2018, 08:46 AM
  2. [SOLVED] Macro to Save range as CSV
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2014, 12:29 PM
  3. [SOLVED] macro to 'save as pdf' that prompts for filename, location AND only prints specified range
    By mtcolombo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 01:49 PM
  4. [SOLVED] Macro to save specific range as bitmap/jpeg
    By wfm007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2013, 04:44 AM
  5. Macro for Save As a pre-determined range of cells, freezing drop down box and date
    By MonseigneurB in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2012, 02:08 PM
  6. Replies: 2
    Last Post: 10-13-2012, 02:12 PM
  7. Macro to Save Multiple copy of spreadsheet from named range
    By Chirayu Amin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2009, 01:46 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