Send email with attachment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all
Does anyone know if it is possible to email an attachment file using Access
I know i can use sendobject command to email the access object (table, query, view, stored procedure, etc...
How about if i have a file which is located in my c: drive and it is just a text file
Thank
May
 
Note: in below code a reference is needed in VBE pointing
to Microsoft Outlook Library

== begin code
Dim ol As Outlook.Application
Dim mi As Outlook.MailItem

On Error GoTo OlNotRunning
Set ol = GetObject(, "Outlook.Application")
Set mi = ol.CreateItem(olMailItem)

With mi
.To = "(e-mail address removed)"
.Attachments.Add "c:\temp\MyTextFile.txt"
.Send
End With
ol.Quit: Set ol = Nothing
End Sub
OlNotRunning:
Set ol = New Outlook.Application
Resume Next
==end code

Krgrds,
Perry

May said:
Hi all,
Does anyone know if it is possible to email an attachment file using Access?
I know i can use sendobject command to email the access object (table,
query, view, stored procedure, etc...)
 
Thank you. It works!!
How about if want to to add some messages other than only the attachment
Could you please tell how to check or detech any new messages in the inbox
Thanks again
Ma

----- Perry wrote: ----

Note: in below code a reference is needed in VBE pointin
to Microsoft Outlook Librar

== begin cod
Dim ol As Outlook.Applicatio
Dim mi As Outlook.MailIte

On Error GoTo OlNotRunnin
Set ol = GetObject(, "Outlook.Application"
Set mi = ol.CreateItem(olMailItem

With m
.To = "(e-mail address removed)
.Attachments.Add "c:\temp\MyTextFile.txt
.Sen
End Wit
ol.Quit: Set ol = Nothin
End Su
OlNotRunning
Set ol = New Outlook.Applicatio
Resume Nex
==end cod

Krgrds
Perr

May said:
Hi all
Does anyone know if it is possible to email an attachment file usin Access
I know i can use sendobject command to email the access object (table
query, view, stored procedure, etc...
 
Back
Top