+ Reply to Thread
Results 1 to 14 of 14

automatically attach and send by e-mail

  1. #1
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82

    automatically attach and send by e-mail

    Hi,

    In a generated workbook I have 2 e-mail adresses in seperate cells
    that I'd like the users to be able to easily send the workbook to.
    One as the recipient and the other as cc.
    So is it possible to either use a link or userform that takes both adresses and
    automatically attaches this workbook ?
    Thanks,

    Simon
    Last edited by Simon-ch; 01-19-2009 at 11:16 AM.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi Simon. This code can be used for your purpose. It will send an Outlook email to the recipients whose email addresses are in A1 and CC to A2. Please modify as needed.

    Also, when you copy this code into the VBE, be sure to select Tools > References, then check the box for "Microsoft Outlook xx.x Object Library".

    Please Login or Register  to view this content.
    HTH

    Jason

  3. #3
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Hi, thanks! But I wouldn't want the mail to be sent automatically, which seems to be what this macro is doing. Rather I just want the New Mail to pop up with the file attached and the 2 recipients in it. They will have to write their own additional text and send it. How can I do that ?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Jason

  5. #5
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Perfect, thanks a lot !

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    No problem, Simon.

    Jason

  7. #7
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Hm.. I have another problem, probably nothing serious as I'm not an expert:
    I have a macro that copies one sheet of the workbook to a new one, but the new, generated sheet still has the link to the old one for my mailing macro and it also attaches the old source sheet, not the newly generated one. How can I change that ?

  8. #8
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    double post
    Last edited by Simon-ch; 01-19-2009 at 06:37 AM. Reason: double post

  9. #9
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I'm not positive, but I think in order for the above code to work, the workbook needs to be saved first. Also, you can try changing ThisWorkbook to ActiveWorkbook.

    HTH

    Jason

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.

    Move to programming

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  11. #11
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Sorry VBA Noob, is it because I asked the same question in a new thread ?
    @ Jasoncw: Thanks, I got it to work with a command button, the only problem I have is that Microsoft Outlook Object Library isn't enabled in the new, generated workbook, so it doesn't work until I enable it manually. (which I can't make the users do)

  12. #12
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Got it to work, am a happy man now !
    Thanks for the help,

    Simon

  13. #13
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Glad you got it, Simon.

    Jason

  14. #14
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    I still seem to have the problem sometimes when other people open the workbook on their computer that they haven't got object library enabled, shouldn't it be enabled because of the workbook itself ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1