• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

How to Send Data Reports as an attachment in Visual Basic

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
Thanks!
0
toutam
Asked:
toutam
2 Solutions
 
DbergertCommented:
Need to USE CDO and an attachment

http://www.mvps.org/access/modules/mdl0019.htm
0
 
toutamAuthor Commented:
Thanks for your help !

I was wondering is there any was thats more simple than that, like what we have in VBA
0
 
almondmitchellCommented:
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")
      msg.to="email address"
      msg.send()

end sub
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now