in vb.net i generate a excel file and open it for printing.
now i want to save or open this excel file in pdf format before printing.
please help me
What I have tried:
Private Sub Print_Proposal()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = New Excel.Application
xlBook = xlApp.Workbooks.Add(Application.StartupPath & "\xyz.xls")
xlSheet = xlBook.Worksheets(1)
xlApp.Visible = True
xlSheet.Cells(7, 3) = Trim(TxtPNo.Text)
xlSheet.Cells(7, 6) = Trim(DtDate.Text)
xlSheet.Cells(8, 6) = Trim(DtDateV.Text)
Dim dlg As New PrintDialog
PrintDialog1.ShowDialog()
If PrintDialog1.ShowDialog = DialogResult.OK Then
xlSheet.PrintOut(1, 1)
End If
xlSheet.PrintOut(1, 1)
xlBook.Close(0)
xlApp.Quit()
xlSheet = Nothing
xlBook = Nothing
xlApp = Nothing