However, I’ve written several tutorials (such as here and here) that have to do with PDF and, more particularly, with the topic of converting PDF files to Excel.
The reason why I write about PDF is relatively straightforward: PDF is one of the most widely used file formats.
The following sample macro (named Save_Excel_As_PDF_1) is, probably, one of the simplest way to save an Excel worksheet as PDF using VBA.
This macro consists of a single simple statement: This statement, can be separated in the following 3 items: Let’s take a closer look at each of these elements: As I explain when introducing the Worksheet.
Type is the only required parameter of the Export As Fixed Format method.
As implied by its name, you use the Filename parameter of the Export As Fixed Format method for purposes of specifying the filename of the new (converted) file.
For these purposes, you use the Quality parameter of the Export As Fixed Format method.
More precisely, you can choose 1 of the 2 xl Fixed Format Quality options: The Include Doc Properties parameter of the Export As Fixed Format method allows you to determine whether the document properties are included in the converted PDF file or not.The basic VBA method you use for converting Excel files to PDF is Export As Fixed Format.Therefore, let’s start this blog post by taking a look at it: The main purpose of the Export As Fixed Format method is to export a particular Excel object (such as a file, worksheet, cell range or chart) to another file format, usually PDF.For these purposes, “expression” is a variable representing a Workbook, Worksheet, Chart or Range object, depending on the particular version of the method you’re working with.In other words, “expression” is the placeholder for the object that you want to actually save as PDF. To try and make it reusable i used the commented code line and also placed the macro in a file.