Closed Thread
Results 1 to 2 of 2

Macro in Excel to send emails in outlook sending hyperlinks but need them to be attachment

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

    Macro in Excel to send emails in outlook sending hyperlinks but need them to be attachment

    Can't figure out how to get this to send as attachments versus right now they are hyperlinks. I have a list of file paths (hyperlinks) in column B, and a list of emails in column C. Any help would be greatly appreciated.


    PHP Code: 
    [PHP]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 = "Test " & 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 
    [/PHP]
    Last edited by L_Misty; 08-04-2017 at 02:12 PM.

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    21,278

    Re: Macro in Excel to send emails in outlook sending hyperlinks but need them to be attach

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Jeff
    | | |?| |?| |?| |?| | |:| | |?| |?|
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 01-31-2017, 11:33 PM
  2. 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
  3. Outlook Macro does run properly when sending excel attachment
    By whosphil in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2014, 02:30 PM
  4. Macro to send an attachment via Outlook from excel
    By dobracik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2014, 04:32 AM
  5. 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
  6. [SOLVED] Macro to send a pdf attachment via outlook from excel
    By Josiah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-2013, 02:17 PM
  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