Results 1 to 6 of 6
  1. #1
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402

    send email with attached image in body

    Is it possible to add an image to an email body using vba?



    I can send an email with -
    .subject
    .body
    .to

    and include an image as well?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Have to wrap the image file path/name in an HTML tag. Review two links referenced in https://www.accessforums.net/program...ook-30846.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    thanks, I had the wrong file name. That works ok now.

  4. #4
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    email images again, sorry about all the little bits on this, this all works ok for a hard coded image -

    "<img src='c:\aaa\logo.bmp'>"

    is it possible to asign a variable to a form field and use that as the file location? as i have several bussineses in one system

  5. #5
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    i threw this together just to see what happens, the finn variable does contain the correct text but the image is a cross in the mail message

    email_logo = DLookup("[Email logo location]", "[application data]", " [company title] = forms![consignment note tracking incoming]![to company] ")
    strt = "<img src='"
    mdl = email_logo
    ennd = "'>"
    finn = strt & mdl & ennd

    and added finn in place of <img src='c:\aaa\logo.bmp'>

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Variables must be concatenated and not enclosed in quotes. Reference to form control is a variable.

    email_logo = DLookup("[Email logo location]", "[application data]", "[company title] = '" & forms![consignment note tracking incoming]![to company] & "'")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-25-2013, 11:01 PM
  2. Send Report as body of email
    By chris.williams in forum Reports
    Replies: 3
    Last Post: 09-15-2012, 09:43 AM
  3. Replies: 1
    Last Post: 06-26-2012, 09:37 AM
  4. Email report as body of email
    By chrish20202 in forum Programming
    Replies: 6
    Last Post: 01-15-2012, 07:23 PM
  5. Send in Email Body vice Attachment
    By cassidym in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 06:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums