+ Reply to Thread
Results 1 to 3 of 3

Modify a macro that creates PDF file from the print area on a worksheet!

  1. #1
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Modify a macro that creates PDF file from the print area on a worksheet!

    Hi

    THis is taken from a macro I use to create a PDF file from the print area set on the sheet and attaches it to an email in Outlook..

    What I would like to do is, based on cell Y4 containing 1 or 2 is to change the print area from $B$1:$M$53 to $B$1:$M$88.

    Is there anything simple that can be changed to do this?

    "ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=PDFFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=OpenPDFAfterCreating"

    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Modify a macro that creates PDF file from the print area on a worksheet!

    Nice little IIF () statement should do the trick.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Modify a macro that creates PDF file from the print area on a worksheet!

    davesexcel, Many thanks for your code,perfect

+ 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. Save an image file of the print area on each worksheet
    By rs1aj in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2016, 05:05 PM
  2. [SOLVED] Save selected print area as a pdf file using the text from a specific cells as the file na
    By A440 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2015, 04:14 PM
  3. Macro - Set Print Area for Changing Data Area
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2013, 04:19 AM
  4. Replies: 1
    Last Post: 01-12-2012, 05:49 AM
  5. Macro to duplicate a worksheet Print Area
    By RobGodfrey in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2011, 06:38 AM
  6. Modify code to email a selected range or ("print area") in lieu of ActiveSheet
    By robertse in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-15-2010, 05:15 PM
  7. [SOLVED] Pivot Table macro to set print area and print details of drill down data
    By Steve Haskins in forum Excel General
    Replies: 2
    Last Post: 12-28-2005, 01:10 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