Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save Excel range as pdf

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
like image 898
cheapkid1 Avatar asked Oct 25 '12 17:10

cheapkid1


People also ask

How do I save a range of cells in Excel?

The most common method is to copy the selection that you want to save as an individual file in Excel, create a new workbook, and paste the copied selection on it, then save it. However, you may lose some format styles in the selection during copying and pasting, such as row height, etc.


1 Answers

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

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

like image 118
SeanC Avatar answered Oct 18 '22 22:10

SeanC