cancel
Showing results for 
Search instead for 
Did you mean: 

How to email more than 1 report using VB.NET 2013 with Crystal Report Sp11

Former Member
0 Kudos

   Dim CrTable As Table

            'Localizo o report

            cryRpt.Load(".\" & Nome_do_Report)

            'Faço a conexao com o servidor aonde esta os report

            With crConnectionInfo

                .ServerName = Conectar_relatorio(1)

                .DatabaseName = Conectar_relatorio(2)

                .UserID = Conectar_relatorio(3)

                .Password = Conectar_relatorio(4)

            End With

            CrTables = cryRpt.Database.Tables

            For Each CrTable In CrTables

                crtableLogoninfo = CrTable.LogOnInfo

                crtableLogoninfo.ConnectionInfo = crConnectionInfo

                CrTable.ApplyLogOnInfo(crtableLogoninfo)

            Next

            cryRpt.VerifyDatabase()

            Dim j As Integer = 1

            For i As Integer = 0 To UBound(Parametro_e_Objeto, 1)

                'Quando i = 2 e j = 2, nada acontece apenas aumenta-se 2 no j que será j = 4 e  i = 3

                If j <> i Then

                    j = i + 1

                    cryRpt.SetParameterValue(Parametro_e_Objeto(i), Parametro_e_Objeto(j))

                Else

                    j = i + 2

                End If

            Next i

            Try

                Dim CrExportOptions As New ExportOptions

                Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()

                Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions

                Dim MailOpts As New MicrosoftMailDestinationOptions()

                ' CrDiskFileDestinationOptions.DiskFileName = Nome_ficheiro & ".pdf"

                CrExportOptions = cryRpt.ExportOptions

                With CrExportOptions

                    .ExportDestinationType = ExportDestinationType.MicrosoftMail

                    .ExportFormatType = ExportFormatType.PortableDocFormat

                    .FormatOptions = CrFormatTypeOptions

                End With

                With MailOpts

                    .MailToList = Enviar_para

                    'Com conhecimento

                    .MailCCList = Cc_para

                    .MailSubject = Assunto

                    .MailMessage = Mensagem

                End With

                CrExportOptions.DestinationOptions = MailOpts

                cryRpt.Export()

            Catch ex As Exception

                guardarErro(ex, " - No procedimento de exportação do report para envio de email " & Nome_do_Report)

            End Try

        Catch ex As Exception

            guardarErro(ex, " - Ligação com report usando parametro para envio de email")

        End Try

Message was edited by: Ludek Uher Please note: English only(!). I did the best translation of the title that I could.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

What is the issue? Errors? Symptoms? Behavior?

See is searching - using the search box in the top right corner will get you info that will help - it should...

Also, SP 11 was removed yesterday due to backward compatibility issues. Consider going back to SP 10.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Answers (0)