12

I'd like to 'save as' a specific sheet or specific range to pdf.

I tried implementing a range into my code.

Here is what I've been working with:

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
  "c:\Book1.pdf", Quality:= _
  xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
  OpenAfterPublish:=True
Community
  • 1
  • 1
cheapkid1
  • 469
  • 7
  • 18
  • 32
  • the code works for me, what part is missing? If you want to use a specific range, move the range to a new sheet and print that sheet to pdf before deleting it, no? – nutsch Oct 25 '12 at 17:26
  • Yes, I suppose that will work fine, however the end result I'm shooting for will be completely automated, so rather than creating a whole bunch of sheets then worrying about deleting them, is there a way I can just select a range then save that to pdf? – cheapkid1 Oct 25 '12 at 17:45

1 Answers1

25

you have the code, just use a range instead of activesheet

e.g. Sheets("Sheet1").Range("B2:H28").ExportAsFixedFormat ...

SeanC
  • 15,695
  • 5
  • 45
  • 66