How do I PrintPrintPreview an Excel File?

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2009
Posts: 94
Reputation: yorro has a little shameless behaviour in the past 
Solved Threads: 6
yorro yorro is offline Offline
Junior Poster in Training

How do I PrintPrintPreview an Excel File?

 
0
  #1
Oct 24th, 2009
How do I Load an excel file to the PrintPreviewDialog?

  1.  
  2. Imports Excel = Microsoft.Office.Interop.Excel
  3. Private Sub btnPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintPreview.Click
  4. Dim xlApp As Excel.Application
  5. Dim xlWorkBook As Excel.Workbook
  6.  
  7.  
  8. xlApp = New Excel.ApplicationClass
  9. xlWorkBook = xlApp.Workbooks.Open(Application.StartupPath & "report_summary.xlsx")
  10.  
  11. MyPrintPreviewDialog.Document = xlWorkBook
  12. If MyPrintPreviewDialog.ShowDialog() = DialogResult.OK Then
  13. xlWorkBook.Close()
  14. xlApp.Quit()
  15. End If
  16. End Sub

Error states that excel cannot be converted to .Document.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 94
Reputation: yorro has a little shameless behaviour in the past 
Solved Threads: 6
yorro yorro is offline Offline
Junior Poster in Training
 
0
  #2
Oct 26th, 2009
I've tried searching for it on the internet and I've came up with nothing specific to my problem.

Note that I want an excel file to show onto the PrintPreviewDialog and NOT use the excel application's built in printpreview using xlWorkbook.printpreview
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 94
Reputation: yorro has a little shameless behaviour in the past 
Solved Threads: 6
yorro yorro is offline Offline
Junior Poster in Training
 
0
  #3
Oct 31st, 2009
Does any one have at least a site or a link to a tutorial of some sort relevant to my query?
Reply With Quote Quick reply to this message  
Reply

Tags
excel, printpreview, vb.net

Message:




Views: 629 | Replies: 2
Thread Tools Search this Thread



Tag cloud for excel, printpreview, vb.net
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC