i am trying to export a crystal report document to excel but it is giving me an error saying that object refference is ...
Any help pliz
Sub cryview()
'This code contains a functionality to export to Excel
'* A sub for every corresponding Crystal Report
Dim rpt As New CrystalReport3()
Dim strExportFile As String = "c:\TestExcel.xls"
Dim sql_personnel As String = procesSQL(txtSQL.Text, cmbTableName.Text)
Dim dt As New DataTable
dt = MyFormz.cl_Class.SelectRows(sql_personnel)
ReportTitle = rpt.ReportDefinition.Sections(0).ReportObjects("txtReportTitle")
ReportTitle.Text = strTitle
ReportPhone = rpt.ReportDefinition.Sections(0).ReportObjects("txtReportPhone")
ReportPhone.Text = Me.txtPhone.Text
Users = rpt.ReportDefinition.Sections(4).ReportObjects("txtUser")
Users.Text = strUserDetails
rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
rpt.ExportOptions.ExportFormatType = ExportFormatType.Excel
Dim objOptions As ExcelFormatOptions = New ExcelFormatOptions
objOptions.ExcelUseConstantColumnWidth = False
rpt.ExportOptions.ExportFormatOptions = objOptions
rpt.SetDataSource(dt)
rpt.Export() '<<<< Object refeerence not set to instance of an object
CrystalReportViewer1.ReportSource = rpt
objOptions = Nothing
rpt = Nothing
End Sub