+ Reply to Thread
Results 1 to 3 of 3

Email Macro help

Hybrid View

  1. #1
    Registered User
    Join Date
    08-05-2004
    Posts
    18

    Email Macro help

    Wondered if anyone can help. I have built a macro that emails people an attached file that I need to send out each day. I also need to copy some cells (A38:A68) into the body of the text (in between 'Please find attached' and 'kind regards') but can't get it to work. Below is my macro so far - can anybody help?

    Thanks

    Sub Mail_workbook_Outlook()


    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)
    strbody = "Dear All," & vbNewLine & vbNewLine & _
    "Please find attached." & vbNewLine & vbNewLine & _
    "Kind regards" & vbNewLine & vbNewLine & _
    "Test" & vbNewLine & vbNewLine


    With OutMail
    .To = "test@test.com"
    .CC = "test@test.com"
    .BCC = ""
    .Subject = "Report"
    .Attachments.Add ("C:\Documents and Settings\Test\Desktop\Report.pdf")
    .Body = strbody
    .Display
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing

    End Sub

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    See Ron's solution ...
    http://www.rondebruin.nl/mail/folder1/mail4.htm
    HTH
    Carim


    Top Excel Links

  3. #3
    Registered User
    Join Date
    08-05-2004
    Posts
    18
    Thanks for that.

    Sadly using Rons's solution will only allow for c. 20 rows but I need about 25 ie A38:A63

    I have used the following text in the vba:

    Sheets("Data").Range("A38").Value & vbNewLine & _
    Sheets("Data").Range("A39").Value & vbNewLine & _

    and so on.

    Any other suggestions?

+ 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