Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Email word + an attachment (97)

    A few months ago I created a word document that had a command button on it that when pushed sent the document via email to a stated email box. I created it so that it could check if the current user was using exchange 5 or outlook. It works fine and have now been asked to refine it.

    Now they want to send the email as before but also attach an external file (happens to be an excel sheet) along with the word document. Until I know the best way forward I have not decide where I should put the excel sheet, either on a server somewhere or on our document management system.

    Is it possible to do this?
    Jerry

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Email word + an attachment (97)

    What kind of code do you use to send the e-mail? If you use something like ActiveDocument.SendMail, you can't attach an Excel spreadsheet. If you use Outlook Automation, you can use the Attachments property of the MailItem object:

    Dim objMailItem As Outlook.MailItem
    Set objMailItem = objOutlook.CreateItem(olMailItem)
    objMailItem.Attachments.Add "C:ExcelTest.xls"

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Email word + an attachment (97)

    Hi Hans,

    If it is not Access one day it is Excel the next, but today it is Word!!

    To make it easier I have attached the code as a text file. As I am checking for exchange and outlook your suggestion may have to be placed in one sub and not the other. I think you will understand when you see it
    Jerry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Email word + an attachment (97)

    Yes, my suggestion will only work in OutlookPost, not in MailPost. As I wrote, SendMail and SendMailAttach don't provide for attaching an Excel spreadsheet (or any attachment other than the Word doc itself). Hopefully others will have suggestions how to do this using Exchange, for I have no experience with that...

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Email word + an attachment (97)

    If you are sending the Word document as an attachment, you could embed the Excel worksheet into the Word file. Not sure if that would work for you (I don't know what happens on the receiving end).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •