944,145 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1707
  • VB.NET RSS
Oct 24th, 2009
0

How do I PrintPrintPreview an Excel File?

Expand Post »
How do I Load an excel file to the PrintPreviewDialog?

vb Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 8
Solved Threads: 7
Junior Poster
yorro is offline Offline
119 posts
since Aug 2009
Oct 26th, 2009
0
Re: How do I PrintPrintPreview an Excel File?
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
Reputation Points: 8
Solved Threads: 7
Junior Poster
yorro is offline Offline
119 posts
since Aug 2009
Oct 31st, 2009
0
Re: How do I PrintPrintPreview an Excel File?
Does any one have at least a site or a link to a tutorial of some sort relevant to my query?
Reputation Points: 8
Solved Threads: 7
Junior Poster
yorro is offline Offline
119 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: visual studio 2008 vb
Next Thread in VB.NET Forum Timeline: printing document





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC