locked
RDCL Creating file and attaching it to email RRS feed

  • Question

  • Hey guys, I have been working on creating reports with datasets in vb, on my run button I am attempting to create a file once the report is ran opening up the outlookemail client and attaching the report as a word document or pdf document from the RCDL viewer... Now What I want to acomplish is once the report runs, it automaticaly creates a pdf file with a given name and the report...and then attach it is to email.com

            Dim StartDate(0) As ReportParameter
            StartDate(0) = New ReportParameter("StartDate", StartDatetxt.Text)
            Me.ReportViewer1.LocalReport.SetParameters(StartDate)
            Me.ReportViewer1.RefreshReport()
            Dim EndDate(0) As ReportParameter
            EndDate(0) = New ReportParameter("EndDate", EndDateTxt.Text)
            Me.ReportViewer1.LocalReport.SetParameters(EndDate)
            Me.ReportViewer1.RefreshReport()

    Process.Start("Outlook.exe")
            Dim oApp As Outlook.Application
            Dim oEmail As Outlook.MailItem
            oApp = New Outlook.Application
            oEmail = oApp.CreateItem(OlItemType.olMailItem)
            With oEmail
                .To = "test@test.com"
                .CC = "test@test.com"
                .Subject = "Weekend Report"
                .BodyFormat = OlBodyFormat.olFormatPlain
                .Body = "Weekend Report"
                .Importance = OlImportance.olImportanceNormal
                .ReadReceiptRequested = True
                .Attachments.Add("C:\test.pdf")
                .Recipients.ResolveAll()
                .Save()
                .Display() 'Show the email message and allow for editing before sending
                '.Send 'You can automatically send the email without displaying it.
            End With
            oEmail = Nothing
            oApp = Nothing

     

    • Moved by Kee Poppy Monday, December 5, 2011 6:02 AM (From:Visual Basic Power Packs)
    • Moved by Martin_Xie Monday, December 5, 2011 6:07 AM Redirect to Report Controls Forum for better support. (From:Off-Topic Posts (Do Not Post Here))
    Friday, December 2, 2011 9:48 PM

All replies

  • Hi kcompres,

    Visual Studio Report Controls forum would be a better place for your question. I will move it there for better support.

    Have a nice day,


    Kee Poppy [MSFT]
    MSDN Community Support | Feedback to us
    Monday, December 5, 2011 6:02 AM
  • Thank you!!!
    Monday, December 5, 2011 1:37 PM