Hi all... this is my first post and help is needed. I am creating a spreadhseet which I can send emailed reports through. I can send the reports but need the olmail.Attachments.Add to work as a variable. As in, I need to be able to change the name of the file. For example I might send January.xlsx but I want the ability for the code to point to excel (like I've done with range as shown in the code) and a specific cell in which I can put February and it will will then look for and attach the February file instead of January. I hope that makes sense.
Sub SendEmail()
'
' SendEmail Macro
'
'
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = Range("XFA1")
olMail.CC = Range("XFB2")
olMail.Subject = Range("G13")
olMail.Body = Range("G17")
olMail.Attachments.Add ("\\RB-BIR-FS1\viewhome\snawaz\Desktop\Corp\(insert variable?)")
olMail.Send
End Sub
Bookmarks