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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now