The correct code is
wb.ExportAsFixedFormat(xlTypePDF, FileName);
or
sheet.ExportAsFixedFormat(xlTypePDF, FileName);
where wb
is a workbook and sheet
is a worksheet. If for some reason, your import library does not define xlTypePDF
, it has value 0.
Some documentation links:
- http://msdn.microsoft.com/en-us/library/office/ff198122.aspx
- http://msdn.microsoft.com/en-us/library/office/ff840291.aspx
- http://msdn.microsoft.com/en-us/library/office/bb241296.aspx
If you read the documentation carefully you will discover that you have been passing the parameters in the wrong order.