Click here to Skip to main content
11,493,154 members (66,143 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
CAn any one please provide me the solution for

Generating PDf from Multiple Excel sheet using VB.net

I am using below code nut it is not working:

 
      Dim fileName As String = AppDomain.CurrentDomain.BaseDirectory & "WeeklyReport"
      Dim xlsApp = New Microsoft.Office.Interop.Excel.Application
     xlsApp.ScreenUpdating = False
      Dim xlsBook As Microsoft.Office.Interop.Excel.Workbook
       Dim paramOpenAfterPublish As Boolean = False
       Dim paramIncludeDocProps As Boolean = True
       Dim paramIgnorePrintAreas As Boolean = True
      Dim paramFromPage As Object = Type.Missing
        Dim paramToPage As Object = Type.Missing
       xlsBook = xlsApp.Workbooks.Open(fileName & ".xls", UpdateLinks:=False, ReadOnly:=False)
 
   xlsBook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fileName & ".pdf", Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityStandard, paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage, paramToPage, paramOpenAfterPublish)
    '    xlsBook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fileName & ".pdf", Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityStandard, Type.Missing, False, Type.Missing, Type.Missing, False, Type.Missing)
     xlsBook.Close(SaveChanges:=False)
       xlsApp.Quit()
Posted 26-Jun-13 23:35pm
Edited 28-Jun-13 1:33am
v3
Comments
Kschuler at 27-Jun-13 17:04pm
   
I added a code block to your question, but you have everything commented out. I'm not sure if some if commented out because you have really excluded it or not. Please click the Improve question and edit the code so we can see what you are really using. Also, you say "it's not working" but what does that mean? Are you getting an error? Is it outputting something you don't want? Please provide more information.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Got the solution ..need to install saveAspdf for office 2007..
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 419
1 Maciej Los 286
2 F-ES Sitecore 224
3 KarstenK 210
4 CPallini 208
0 Sergey Alexandrovich Kryukov 10,132
1 OriginalGriff 8,630
2 Sascha Lefèvre 3,624
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100