How to Send Data Reports as an attachment in Visual Basic

Posted on 2006-07-20
Last Modified: 2010-04-29
Hi All

Is there a single simple command in VB that compares to SendObject in VBA?
I have to automatically send an email from my application. I have been
using the following in VBA:

DoCmd.SendObject acSendReport, ObjectName:=stDocNameA, outputformat:=acFormatRTF, To:=toText, Subject:=FileName

Plz help me, its urgent
Question by:toutam

Accepted Solution

Dbergert earned 63 total points
ID: 17149151
Need to USE CDO and an attachment

Author Comment

ID: 17153437
Thanks for your help !

I was wondering is there any was thats more simple than that, like what we have in VBA

Assisted Solution

almondmitchell earned 62 total points
ID: 17177515
Public Class Form1

      Dim App As Outlook._Application
      Dim Msg As Outlook._MailItem

private sub button1_click

      App = New Outlook.Application
      Msg = App.CreateItem(Outlook.OlItemType.olMailItem)

'*************** add attachment  and send ******************

      Msg.Attachments.Add("c:\source")"email address"

end sub

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide vba in gp 7 94
Please explain: Aspect Oriented Programming 2 92
program a usb light to turn on when needed 7 60
sp_configure 'external scripts enabled', 1; 7 49
This article will show, step by step, how to integrate R code into a R Sweave document
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question