Creating an email with attachments through VBA

Posted on 2009-02-23
Last Modified: 2012-08-13
I need my users to be able to create and email that may contain several attachments, will use their own autosignature at the bottom (without being reformatted) and if possible be able to add a default line of additional text into the emails body.

All of the users have Access 2003 and Outlook 2003 upwards.

Thank you.
Question by:Andy Brown
    LVL 84
    The AutoSig in a function of Outlook ... AFAIK, the only way to include that through a 3rd party item (like Access) is to actually include it when you build the email. See this link for how to do this:

    You can automate Outlook and build an email with as many attachments as you need:

    Note this uses Early Binding, which requires you to have a reference to the Outlook Library. If you'd prefer to use Late Binding, which does NOT require a reference and instead uses whatever version is installed on the machine:

    Author Comment

    by:Andy Brown
    Close, but I was hoping to find a solution that wouldn't care if it was XP/Vista or RTF/HTML.
    LVL 84
    I'm not sure what you mean ... the code I suggested would work on any machine, regardless of the OS, so long as Outlook was installed.

    As to HTML vs RTF - I'm not sure what you're referring to. The code I suggest is an example, and you would of course have to customize it to your needs.

    Author Comment

    by:Andy Brown
    Fair enough - and yes I am slowly getting it to work.  The problem that I've got is that it will be run from different environments.  Some with vista, some with XP, some using RTF and some using HTML emails - so i was really just trying to get a catch all solution.
    LVL 84

    Accepted Solution

    Certainly ... but the code supplied should work with any Operating System, assuming the user has sufficient permissions to read the directories where the sig files live (and they should, since those sig files belong to that user).

    As to RTF-HTML - RTF is an incredibly complex monster, but if all you're doing is adding the Sig file, that would be formatted in RTF already, so you should be fine with it. HTML is a lot easier to work with and handle.

    Author Closing Comment

    by:Andy Brown
    Spot on.  Thanks again.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now