+ Reply to Thread
Results 1 to 3 of 3

Macro to create an e-mail using an Outlook Template and add an attachment

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    Annecy, France
    MS-Off Ver
    Excel 2007
    Posts
    1

    Cool Macro to create an e-mail using an Outlook Template and add an attachment

    Hello Guys!

    As this is my first thread here I'd like to say that this Forum has been extremely useful for me since I joined. My boss insists on using MS Excel for some databases and I've been fighting hard in trying to automate all procedures we do as much as we can.

    Recently I have deloped a code that takes a line of data from our database, transfer it to a nice looking Excel form for the revision of a group, saves this new form created at a backup location and then starts a PDF printer.

    Now, I want to create an additional "Sub" that could generate an e-mail based on an Outlook e-mail template (*.oft), attaching the PDF file which has been generated by the previous macro. The PDF name is sequential and automatically generated by the previous macro as well (0001, 0002, 0003 and so on).

    Anyone, any idea on how to solve it?

    Thanks!

  2. #2
    Registered User
    Join Date
    11-19-2012
    Location
    Wroclaw, Poland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro to create an e-mail using an Outlook Template and add an attachment

    Hi hsarro,

    I have been using such macro for some time now. It works really cool with office 2010 don't know how it will run on 2007. One more thing it is attaching only one specific file with the given path,

    Please Login or Register  to view this content.
    This will give you some hints and maybe some other guys can advise on how to add the automatically generated pdfs,

    Cheers

  3. #3
    Forum Contributor
    Join Date
    04-03-2011
    Location
    India
    MS-Off Ver
    Excel 2015
    Posts
    122

    Re: Macro to create an e-mail using an Outlook Template and add an attachment

    Hi,

    Is it possible to add this code in below ... i have tried it but template will not appear !! Please help me

    HTML Code: 
    Sub yoga()
    Set myOlApp = CreateObject("Outlook.Application")
    Set myitem = myOlApp.CreateItemFromTemplate("c:\users\yogananda\desktop\yoga.oft")
    myitem.SentOnBehalfOfName = "I use this because I need to send it on behalf of somebody"
    myitem.Display
    Set myAttachments = myitem.Attachments
    myAttachments.Add "c:\users\yogananda\desktop\yoga.oft"
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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