Edit: I have a user control with embedded excel sheet and gridviews ( WinForm). I have a form which has that user control. I have a print button on top and I want to convert the whole form into printable format. Any suggestion on how to move ahead?
Asked
Active
Viewed 847 times
2 Answers
0
Printing an Excel document can be done using the Workbook.ExportAsFixedFormat
method:
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF
FileName:=“sales.pdf”
Quality:=xlQualityStandard
DisplayFileAfterPublish:=True
This method should be preferred over using SaveAs
because it also allows specifying all PDF / XPS options.
Note: This method has been added to the Excel object model with Excel 2007 and requires the Save as PDF or XPS Add-in for 2007 Microsoft Office programs to be installed.
See this related question: What is the FileType number for PDF in Excel 2007 that is needed to save a file as PDF through the API?

Community
- 1
- 1

Dirk Vollmar
- 172,527
- 53
- 255
- 316
-
I want to print the excel worksheet and two other gridviews that are there in the user control all in a single click of button. – Apr 24 '09 at 14:49
0
For versions earlier than 2007 you can embed/install a PDF printer and use the PrintOut
method, specifying ActivePrinter
as required.

Lunatik
- 3,838
- 6
- 37
- 52