The Code works just need help with filtering the attachments to certain file extension for example (*.PDF, *.XLS, *.LAS) Thanks in advanced
Dim OutApp As Object Dim xlSheet As Object Dim OutMail As Object Dim i As Long Dim SendTO As String Dim olInsp As Object Dim wdDoc As Object Dim oRng As Object SendTO = Range("W5").Value SendCC = Range("H36").Value Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) Set xlSheet = ActiveWorkbook.Sheets("COG Inter-Curve-Lateral") xlSheet.Range("C7:I25").Copy On Error Resume Next With OutMail .To = SendTO .CC = SendCC .BCC = "" .Subject = Range("C1") Set olInsp = .GetInspector Set wdDoc = olInsp.WordEditor Set oRng = wdDoc.Range oRng.Collapse 1 oRng.Paste For i = 23 To FileCount + 27 .Attachments.Add (Range("W20").Value & "\" & Range("W" & i).Value) Next i .Display 'or use .Send End With On Error GoTo 0 Range("A1").Select Application.CutCopyMode = False Set OutMail = Nothing Set OutApp = Nothing Set xlSheet = Nothing Set olInsp = Nothing Set wdDoc = Nothing Set oRng = Nothing End Sub
Bookmarks