{"id":12167,"date":"2012-11-20T10:59:37","date_gmt":"2012-11-20T10:59:37","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=2591"},"modified":"2012-11-20T10:59:37","modified_gmt":"2012-11-20T10:59:37","slug":"save-an-excel-sheet-as-pdf","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2012\/11\/save-an-excel-sheet-as-pdf\/","title":{"rendered":"How to Export an Excel Sheet as PDF file"},"content":{"rendered":"
Dear Readers, <\/p>\n <\/p>\n <\/p>\n Above code first split your Excel Sheet in Page View Layout as shown below and then it exports it in PDF form. Therefore, if you want to see how it should look like in PDF, you can go in Page View layout in Excel and see. You can also adjust the Margin in the layout. Also in the Layout View you can Add the Header and many more things like Page Number, Date Time etc which will not be seen in Normal View. But if you generate the pdf from that then those settings will reflect in your PDF file.
\n
\nIn this article you are going to learn How to save an Excel Sheet as pdf file<\/font>. Many a times we generate certain reports in an Excel Sheet but while sending that report to your boss, you want that to be saved in a PDF form. In such case you can simply save your Whole Sheet or a particular range from that sheet in PDF form. You can also Enter headers and footers in the Page Layout view in the Excel. <\/p>\n1. Code which export your active excel sheet as PDF<\/h2>\n
\n\nWith ActiveSheet\n .ExportAsFixedFormat _\n Type:=xlTypePDF, _\n Filename:=\"C:\\Users\\Vish\\File_Name.pdf\", _ \n Quality:=xlQualityStandard, _\n IncludeDocProperties:=True, _\n IgnorePrintAreas:=False, _\n OpenAfterPublish:=False \nEnd With\n\n<\/code><\/pre>\n
2. Code which export any specific Sheet as PDF<\/h2>\n
\n\nWith Sheets(\"Your Sheet Name\")\n .ExportAsFixedFormat _\n Type:=xlTypePDF, _\n Filename:=\"C:\\Users\\Vish\\File_Name.pdf\", _ \n Quality:=xlQualityStandard, _\n IncludeDocProperties:=True, _\n IgnorePrintAreas:=False, _\n OpenAfterPublish:=False \nEnd With\n\n<\/code><\/pre>\n
3. Export a Specific Range from a Sheet as PDF<\/h2>\n
\n\nWith Sheets(\"Your Sheet Name\").Range(\"A1:F15\")\n .ExportAsFixedFormat _\n Type:=xlTypePDF, _\n Filename:=\"C:\\Users\\Vish\\File_Name.pdf\", _ \n Quality:=xlQualityStandard, _\n IncludeDocProperties:=True, _\n IgnorePrintAreas:=False, _\n OpenAfterPublish:=False ' \nEnd With\n\n<\/code><\/pre>\n
Important:<\/h2>\n
\n
\n