1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Excel 2007 Automatic E-mail

Discussion in 'Business Applications' started by computerman29642, Sep 25, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Is there a way to have Excel 2007 to automatically send a document by e-mail (not an XLS file)?
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,546
    The below is a cut-down of this code.

    Note that (i) client is Outlook (ii) early binding requires setting a reference to Outlook in Excel's VBE before use.

    HTH

    Sub SendWithAtt()

    Dim olApp As Outlook.Application
    Dim olMail As MailItem
    Dim CurrFile As String

    Set olApp = New Outlook.Application
    Set olMail = olApp.CreateItem(olMailItem)

    With olMail
    .To = "[email protected]"
    .Subject = "This is the subject"
    .Attachments.Add "C:\Documents and Settings\Andy\My Documents\test.doc"
    .Display
    .Send
    End With

    Set olMail = Nothing
    Set olApp = Nothing

    End Sub
     
  3. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Bomb, the code looks great.

    Here is something wierd. I tested the code by sending an e-mail to myself. When I look in th esent folder, I can see the e-mail was sent. However, I never received the e-mail.
     
  4. computerman29642

    computerman29642 Thread Starter

    Joined:
    Dec 4, 2007
    Messages:
    2,895
    Nevermind. The first test did not work, but I have been able to get two other test e-mails to work.

    Thank you very much, Bomb. :)
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/753225

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice