Excel VBA Macro: Send Email with All Files (in a Specific Folder) Attached
greggowaffles
View ChannelAbout
My mission is to create tutorials that are fun, easy to understand, and connected to real world scenarios.
Latest Posts
Video Description
💼 Hire Me for Excel VBA Automation Need help automating your Excel workflows? I specialize in building custom Excel VBA solutions to save you time and eliminate repetitive tasks. 👉 https://www.upwork.com/freelancers/~013bd05e311ebf4a2c #ExcelVBA #ExcelMacroExcel VBA Macro: Attach All Files (in a Specific Folder) to an Email and Send. In this video, we write code in VBA to add all files in a folder to an email using a Do While Loop. Code (YouTube doesn't allow brackets; so LT and GT are used for less than and greater than, respectively): Sub email_all_files_in_folder() Dim OutApp As Object Dim OutMail As Object Dim strbody As String Dim myFldr As String Dim myFile As String Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) myFldr = "C:\Users\greggowaffles\Documents\Youtube Videos\Test\Sample Data Files\" myFile = Dir(myFldr) strbody = "LT BODY style = font-size:11pt; font-family:Arial GT" & _ "Hi Team, LT p GT Please see file(s) attached. LT p GT" & _ "Thanks, LT br GT Greg" On Error Resume Next With OutMail .To = "[email protected]" .CC = "" .BCC = "" .Subject = "Daily File(s) " & Format(Date, "mm/dd/yyyy") .Display .HTMLBody = strbody & .HTMLBody Do While myFile LT GT "" .Attachments.Add myFldr & myFile myFile = Dir Loop End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub #ExcelVBA #ExcelMacro
Streamline Your Email Workflow
AI-recommended products based on this video

Barnyard Designs Indoor Herb Garden Planter Set with Tray, Metal Windowsill Plant Pots with Drainage for Outdoor or Indoor Plants, Set/3 (White)

SunKol 10.1" IP67 Rugged Tablet (N5100 8GB+256GB) Windows 11 Pro Waterproof Industrial Tablet PC, Fingerprint, 12000mAh Battery, 500nit, GPS, WiFi, 4G, BT4.2, for Outdoor Field Work























