+ Reply to Thread
Results 1 to 4 of 4

Print/Save to .pdf using a Macro that references a range/cell

  1. #1
    Registered User
    Join Date
    09-20-2017
    Location
    Michigan
    MS-Off Ver
    2016
    Posts
    4

    Print/Save to .pdf using a Macro that references a range/cell

    Hello,

    I am attempting to use an Excel Macro to print/save a file that has its file directory in a cell, in this case B3. Is this possible, as I have spent hours searching for a solution or help on how to do it but have had no luck. Basically, you click the button to the right of it and then prints the file is in the cell. See picture below. I use Excel 2013. If possible, please help or link me to any useful guides.
    Capture.PNG

    Thank you

    edit:
    I want to print/save to pdf the file that has it's directory in the cell off of this sheet. I have to deal with sending out dozens of excel files that I have to manually print/save to pdf and it is very time consuming.
    Last edited by WithinTheLight; 02-23-2018 at 10:29 AM.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Print/Save to .pdf using a Macro that references a range/cell

    vFile = range("B3").value & ".pdf"

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    vFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= False

  3. #3
    Registered User
    Join Date
    09-20-2017
    Location
    Michigan
    MS-Off Ver
    2016
    Posts
    4

    Re: Print/Save to .pdf using a Macro that references a range/cell

    Quote Originally Posted by ranman256 View Post
    vFile = range("B3").value & ".pdf"

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    vFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= False
    Unfortunately it did not work. It still prints out the active sheet. What I am trying to achieve is that when you click the button, it will print the file in the range. Not print the current worksheet as that files name.

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Print/Save to .pdf using a Macro that references a range/cell

    set print area, then print.

+ 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. Macro, to Set Print Area, Save as, Print
    By paul0872829332 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2015, 04:57 AM
  2. [SOLVED] Run a macro before you save or print off
    By Aris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2014, 10:59 PM
  3. [SOLVED] Save/Print Macro
    By njb2.0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2013, 03:39 PM
  4. where can i find macro codes for various functions such print, save and save as
    By fellayaboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2011, 02:06 AM
  5. Print only visible rows and a print to or save as pdf Macro
    By rlebeausw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2011, 10:08 PM
  6. save as and print options macro
    By ramblin racer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-01-2007, 03:48 AM
  7. Recording Macro to save worksheet and print
    By dmacman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2005, 11:36 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