Exportasfixedformat Pdf. Saves the document in pdf or xps format. Public void exportasfixedformat string outputfilename microsoft office interop word wdexportformat exportformat bool openafterexport false microsoft office interop word wdexportoptimizefor optimizefor microsoft office interop word wdexportoptimizefor wdexportoptimizeforprint microsoft office interop word wdexportrange range microsoft office interop word wdexportrange wdexportalldocument int from 1 int to 1 microsoft office interop.
You can apply the exportasfixedformat method to several excel objects. The exportasfixedformat method is used to publish a workbook to either the pdf or xps format. Sub saveselectionaspdf create and assign variables dim savelocation as string savelocation c users marks onedrive documents mypdffile pdf save selection as pdf selection exportasfixedformat type xltypepdf filename savelocation end sub save a range as pdf.
You can apply the exportasfixedformat method to several excel objects.
This simple procedure will print the activesheet to a pdf. The fixedformattype parameter value can be one of these ppfixedformattype constants. 2 minutes to read. The path and file name of the new pdf or xps file.