I found a sample VB program at CrystalDcisions.
It seems to do everything I need except import a reort to a
pagintaed text file with 61 lines. The following is the code. In Private Sub cmdExpSil_Click() I am trying to make it import to the paginated text file than the word document. If anyone has any ideas I would appreciate it.
Thanks.
Sincereley, Bill
-----------------------------------------------------------
Dim ReportFileName
Dim CrystalApplication As Application
Dim CrystalReport As Report
Dim CrystalOptions As ExportOptions
Dim Lines As Integer
Private Sub cmdEmail_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Set CrystalOptions = CrystalReport.ExportOptions
CrystalOptions.DestinationType = crEDTEMailMAPI
CrystalOptions.MailSubject = "Testing Report Export via Email"
CrystalOptions.MailMessage = "Here is the latest test."
CrystalOptions.MailToList = "Recipient Name"
CrystalOptions.FormatType = crEFTText
Call CrystalReport.Export(False)
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdExpMan_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Call CrystalReport.Export(True)
End Sub
Private Sub cmdExpSil_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Set CrystalOptions = CrystalReport.ExportOptions
CrystalOptions.DestinationType = crEDTDiskFile
CrystalOptions.FormatType = crEFTWordForWindows
'CrystalOptions.FormatType = crEFTPaginatedText
' CrystalReport.ExportOptions.NumberOfLinesPerPage = 61
'CrystalOptions.DiskFileName = "C:\TEMP\OLETEST.DOC"
CrystalOptions.DiskFileName = "R:\Scan\Crystal\txthcfa.txt"
Call CrystalReport.Export(False)
End Sub
Private Sub cmdPreview_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Call CrystalReport.Preview
End Sub
Private Sub cmdReport_Click()
CommonDialog1.Filter = "Crystal Reports (*.RPT)|*.RPT"
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
ReportFileName = CommonDialog1.FileName
Set CrystalReport = CrystalApplication.OpenReport(ReportFileName)
End Sub
Private Sub Form_Load()
Set CrystalApplication = CreateObject("Crystal.CRPE.Application"
End Sub
It seems to do everything I need except import a reort to a
pagintaed text file with 61 lines. The following is the code. In Private Sub cmdExpSil_Click() I am trying to make it import to the paginated text file than the word document. If anyone has any ideas I would appreciate it.
Thanks.
Sincereley, Bill
-----------------------------------------------------------
Dim ReportFileName
Dim CrystalApplication As Application
Dim CrystalReport As Report
Dim CrystalOptions As ExportOptions
Dim Lines As Integer
Private Sub cmdEmail_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Set CrystalOptions = CrystalReport.ExportOptions
CrystalOptions.DestinationType = crEDTEMailMAPI
CrystalOptions.MailSubject = "Testing Report Export via Email"
CrystalOptions.MailMessage = "Here is the latest test."
CrystalOptions.MailToList = "Recipient Name"
CrystalOptions.FormatType = crEFTText
Call CrystalReport.Export(False)
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdExpMan_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Call CrystalReport.Export(True)
End Sub
Private Sub cmdExpSil_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Set CrystalOptions = CrystalReport.ExportOptions
CrystalOptions.DestinationType = crEDTDiskFile
CrystalOptions.FormatType = crEFTWordForWindows
'CrystalOptions.FormatType = crEFTPaginatedText
' CrystalReport.ExportOptions.NumberOfLinesPerPage = 61
'CrystalOptions.DiskFileName = "C:\TEMP\OLETEST.DOC"
CrystalOptions.DiskFileName = "R:\Scan\Crystal\txthcfa.txt"
Call CrystalReport.Export(False)
End Sub
Private Sub cmdPreview_Click()
If Len(ReportFileName) = 0 Then
MsgBox "Error: First you must choose a Report File Name."
Exit Sub
End If
Call CrystalReport.Preview
End Sub
Private Sub cmdReport_Click()
CommonDialog1.Filter = "Crystal Reports (*.RPT)|*.RPT"
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) = 0 Then
Exit Sub
End If
ReportFileName = CommonDialog1.FileName
Set CrystalReport = CrystalApplication.OpenReport(ReportFileName)
End Sub
Private Sub Form_Load()
Set CrystalApplication = CreateObject("Crystal.CRPE.Application"
End Sub