+ Reply to Thread
Results 1 to 1 of 1

Macro in Excel to send emails in outlook sending hyperlinks but need attachments

  1. #1
    Registered User
    Join Date
    04-15-2015
    Location
    South Dakota
    MS-Off Ver
    Microsoft Office 2013
    Posts
    23

    Macro in Excel to send emails in outlook sending hyperlinks but need attachments

    Just need the email to send a attachment versus now it is sending a hyperlink. I have a list of the file paths (hyperlinks) in column B, and a list of the emails in column C. Any help would be greatly appreciated. The hyperlinks in column B are excel file paths.

    PHP Code: 
    Sub Send_Files()

        
    Dim OutApp As Object
        Dim OutMail 
    As Object
        Dim sh 
    As Worksheet
        Dim cell 
    As Range
        Dim FileCell 
    As Range
        Dim rng 
    As Range

        With Application
            
    .EnableEvents False
            
    .ScreenUpdating False
        End With

        Set sh 
    Sheets("LogSheet")

        
    Set OutApp CreateObject("Outlook.Application")

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

            
    'Enter the path/file names in the B:B column in each row
            Set rng = sh.Cells(cell.Row, 1).Range("b1:b1")

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

                With OutMail
                    .to = cell.Value
                    .Subject = "July Statement " & cell.Offset(0, 2)
                    .Body = "Please find your July statement attached.  If possible have back to me no later than Friday August 11.  " & cell.Offset(0, -1).Value

                    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

                    .Send  '
    Or use .Display
                End With

                Set OutMail 
    Nothing
            End 
    If
        
    Next cell

        Set OutApp 
    Nothing
        With Application
            
    .EnableEvents True
            
    .ScreenUpdating True
        End With
    End Sub 
    Last edited by L_Misty; 08-04-2017 at 02:29 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 08-04-2017, 03:02 PM
  2. Replies: 0
    Last Post: 01-31-2017, 11:33 PM
  3. Macro help with sending emails from outlook base on excel dates
    By Wery123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2015, 12:42 AM
  4. Excel macro that will send emails from outlook
    By terreese in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2014, 11:57 AM
  5. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  6. [SOLVED] Bulk emails send use outlook & excel coding macro
    By sonu_kumar444 in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 12-26-2012, 08:06 AM
  7. Sending macro emails using excel: Send emails with their passwords.
    By loveisblind in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 03:16 PM

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