+ Reply to Thread
Results 1 to 2 of 2

Copy Range and Paste it in Outlook

  1. #1
    Registered User
    Join Date
    11-18-2011
    Location
    Ghana, Accra
    MS-Off Ver
    Excel 2007
    Posts
    18

    Copy Range and Paste it in Outlook

    Hello Gurus,

    The code below is to send personalised emails, i however want to include the range M3:M31 as part of the body of the email. i need assistance to modify the code below to copy and paste this range into outllook. thanks





    Sub Send_Files()
    'Working in 2000-2010
    Dim OutApp As Object
    Dim OutMail As Object
    Dim sh As Worksheet
    Dim cell As Range, FileCell As Range, rng As Range
    Dim LValue As String



    LValue = Format(Date, "dd-mmm-yy", vbUseSystemDayOfWeek)

    With Application
    .EnableEvents = False
    .ScreenUpdating = False
    End With


    Set sh = Sheets("Send Personal Email")


    Set OutApp = CreateObject("Outlook.Application")


    For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)


    'Enter the file names in the C:Z column in each row
    Set rng = sh.Cells(cell.Row, 1).Range("C1:Z1")


    If cell.Value Like "?*@?*.?*" And _
    Application.WorksheetFunction.CountA(rng) > 0 Then
    Set OutMail = OutApp.CreateItem(0)


    With OutMail
    .To = cell.Value
    .Subject = "Testfile as at " & LValue
    .Body = "Hello " & cell.Offset(0, -1).Value & vbNewLine & "Please find attached our Weekly report for the week ending " & LValue & "." & _
    " Please do not hesitate to contact me should if you have any questions or comments"



    For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
    If Trim(FileCell) <> "" Then
    If Dir(FileCell.Value) <> "" Then
    .Attachments.Add FileCell.Value
    End If
    End If
    Next FileCell
    .Display 'Or use Send
    End With


    Set OutMail = Nothing
    End If
    Next cell


    Set OutApp = Nothing
    With Application
    .EnableEvents = True
    .ScreenUpdating = True
    End With
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Copy Range and Paste it in Outlook

    This is pretty dirty, and I don't have Outlook to test it with, but put this after your .Body= statement:

    Please Login or Register  to view this content.
    You should be able to do a copy/paste, but I'm not sure how it would get integrated into the .Body.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

+ 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