Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Crystal Report 8 via VB CODE 1

Status
Not open for further replies.

krshaikh

Programmer
Nov 18, 2001
45
US
Hi,

I am using Crystal Report version 8. I have to export a report to MS Word format through VB Code. I have tried to look for a suitable example but most of them deal with .NET

This solution will be installed as an activeX dll or server on my WEB SERVER so I need something which does not involve user interaction.

Thanks for the help,

Regards,

- Krshaikh -
 
I use this to export to word using vb6.

Private Sub LombardDailyMI()


'if error happens move to checkerror
On Error GoTo checkerror

'declare variables
Dim applLombardDailyMI As New CRAXDDRT.Application
Dim reportLombardDailyMI As New CRAXDDRT.Report

'change mousepointer
Screen.MousePointer = vbHourglass

Set reportLombardDailyMI = applLombardDailyMI.OpenReport("\\dahl\Input\48\3848\52833f898f65b0.rpt")


reportLombardDailyMI.Database.LogOnServer "pdsodbc.dll", "Commercial Live", "", "-username-", "-password-"

For i = 1 To reportLombardDailyMI.Database.Tables.Count
reportLombardDailyMI.Database.Tables(i).SetLogOnInfo "Commercial Live", "", "-username-", "-password-"
Next i

'delete the saved data
reportLombardDailyMI.DiscardSavedData


With reportLombardDailyMI.ExportOptions
.DestinationType = crEDTEMailMAPI
.FormatType = crEFTExactRichText
NOTE - You will need to enter a location to store the report
End With


'dont prompt for export options
reportLombardDailyMI.Export False

Screen.MousePointer = vbDefault


Set reportLombardDailyMI = Nothing
Set applLombardDailyMI = Nothing

Exit Sub

checkerror:

' Start Outlook.
' If it is already running, you'll use the same instance...
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")

' Logon. Doesn't hurt if you are already running and logged on...
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon

' Send a message to your new contact.
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
' Fill out & send message...
olMail.To =
olMail.CC =
olMail.Subject = "ERROR on LombardDailyMI"
olMail.Body = Err.Number & "-" & Err.Description
olMail.Send

olNs.Logoff
Set olNs = Nothing
Set olMail = Nothing
Set olApp = Nothing

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top