+ Reply to Thread
Results 1 to 3 of 3

How Do I attach a atachment to a VBA created email?

  1. #1
    Dan Gardner
    Guest

    How Do I attach a atachment to a VBA created email?

    I’ve created an outlook email in a macro using the following code;

    'Control Microsoft Outlook and create a new Email
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    myItem.To = Worksheets("Sheet1").Cells(2, 17).Value
    'Assign a Subject to the Email
    myItem.Subject = Worksheets("Sheet1").Cells(1, 1).Value
    'Attach File to Mesage
    myItem.body = ???????

    'Send the Email
    myItem.Send

    As you can see I can't seam to figure out the Attach file command. Any help
    would be greatly appreciated.

    Thanks,
    Dan


  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Dan

    hope this help

    ...
    myItem.Attachments.Add "C:\Documents and Settings\fichier.txt"
    ...


    regards
    michel

  3. #3
    Norman Jones
    Guest

    Re: How Do I attach a atachment to a VBA created email?

    Hi Dan,

    Visit Ron de Bruin's web site at:

    http://www.rondebruin.nl/sendmail.htm


    ---
    Regards,
    Norman



    "Dan Gardner" <[email protected]> wrote in message
    news:[email protected]...
    > I've created an outlook email in a macro using the following code;
    >
    > 'Control Microsoft Outlook and create a new Email
    > Set myOlApp = CreateObject("Outlook.Application")
    > Set myItem = myOlApp.CreateItem(olMailItem)
    > myItem.To = Worksheets("Sheet1").Cells(2, 17).Value
    > 'Assign a Subject to the Email
    > myItem.Subject = Worksheets("Sheet1").Cells(1, 1).Value
    > 'Attach File to Mesage
    > myItem.body = ???????
    >
    > 'Send the Email
    > myItem.Send
    >
    > As you can see I can't seam to figure out the Attach file command. Any
    > help
    > would be greatly appreciated.
    >
    > Thanks,
    > Dan
    >




+ 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