I'm trying to programmatically export a crystal report to a word document in
VB.net. Here is the code that I found in help, but it isn't working. Any ideas?
code starts
************************************************** ********************
'' Declare variables and get the export options.
Dim exportOpts As New ExportOptions
Dim diskOpts As New DiskFileDestinationOptions
Dim wordFormatOpts As New ExcelFormatOptions
exportOpts.ExportFormatType = ExportFormatType.WordForWindows
exportOpts.FormatOptions = wordFormatOpts
'' Set the export format.
exportOpts.ExportFormatType = ExportFormatType.WordForWindows
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
'' Set the disk file options.
Dim newLast As String
newLast = LastName
Dim posLast As Integer
posLast = Len(LastName) - 1
newLast = Microsoft.VisualBasic.Left(LastName, posLast)
diskOpts.DiskFileName = newLast & "_" & Month(CDate(Now())) & Year(CDate(Now()))
exportOpts.DestinationOptions = diskOpts
UserExpenseReports2.Export()
************************************************** ********************
code ends