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