Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 23rd, 2005, 04:00 PM
Authorized User
Join Date: Aug 2004
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outlook email through Access

How would I email an attachment in access 2003, Ive been doing the exercises in the Access 2003 VBA book those are cool but I need to find out how to export data from a table to a spreadsheet and HTML format then email them as attachments??

Old August 26th, 2005, 11:31 AM
Registered User
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

i used the below code to create a SNP file attach to an email and send to the specified address, this code will bypass the "a program is trying to send an email" security feature in Outlook

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.OpenReport "Emergency Energize", acViewNormal, , , acWindowNormal
    Dim outfile As String
outfile = "C:\Emergency_Energize.SNP"
DoCmd.OutputTo acOutputReport, "Emergency Energize", acFormatSNP, outfile
Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olMailItem)
    With objmail
        .To = "" 'enter in here the email address
        .CC = "" 'enter in here the email address
        .Subject = "" ' & dname
        .Body = "" & _
            vbCrLf & "" & vbCrLf
        .NoAging = True
        .Attachments.Add "C:\Emergency_Energize.SNP" 'adds attachment to email
    End With
    Set objmail = Nothing
    Set objol = Nothing
    SendKeys "%{s}", True 'send the email without prompts

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 Email into Access annienml Access VBA 3 March 28th, 2007 03:51 AM
Access email blocked by Outlook access Access 3 June 16th, 2005 07:23 AM
Outlook Email Fomatting roguedog Access 1 February 1st, 2005 05:02 PM
Sending an email without Outlook SaharaWizard Pro VB 6 3 August 12th, 2004 04:15 PM
Email using Outlook Ben Access VBA 3 January 30th, 2004 05:39 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.