View Full Version : [SOLVED:] VBA to email multiple .Pdf from specified folders.
Ro3k3loo5
12-05-2019, 02:47 AM
I am new to the VBA thing and mostly find a code online and adapt it to work for me. This time I am not managing
What I am attempting to do is email the latest .pdf file attachment from multiple folders that will be specified in multiple cells.
Ro3k3loo5
12-05-2019, 10:49 PM
25557
Ro3k3loo5
12-05-2019, 10:51 PM
Could not send the code in text so had to send a image of what I have and the problem Im running into.
Ro3k3loo5
12-06-2019, 02:03 AM
Option Explicit
Sub SendMail()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Dim blRunning As Boolean
blRunning = True
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then
Set olApp = New Outlook.Application
blRunning = False
End If
On Error GoTo 0
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.Subject = "Benchmarking"
.Recipients.Add Range("c2").Value
.Recipients.Add Range("c3").Value
.Recipients.Add Range("c4").Value
.Recipients.Add Range("c5").Value
.Attachments.Add Range("g2").Value
.Attachments.Add Range("g3").Value
.Attachments.Add Range("g4").Value
.Attachments.Add Range("g5").Value
.Body = "New benchmarking reports"
.Display
End With
If Not blRunning Then olApp.Quit
Set olApp = Nothing
Set olMail = Nothing
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.