I am currently using the code attached to send a single file path. Would somebody be able to help me modify the code to send all files in a particular folder instead of just 1 file?
I am currently using the code attached to send a single file path. Would somebody be able to help me modify the code to send all files in a particular folder instead of just 1 file?
Look me up on LinkedIn: https://www.linkedin.com/in/robbiedepalma/
?
Sub vbax_61999_email_all_files_in_folder() Dim strFolder As String Dim fso As Object Dim fsoFolder As Object Dim fsoFile As Object Set fso = CreateObject("Scripting.FileSystemObject") With CreateObject("Outlook.Application") For i = 2 To Cells(Rows.Count, 2).End(xlUp).Row strFolder = Range("C" & i).Value If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\" Set fsoFolder = fso.GetFolder(strFolder) With .CreateItem(olMailItem) .To = Range("B" & i).Value .Subject = Range("I2").Value .Body = Range("J2").Value For Each fsoFile In fsoFolder.Files .Attachments.Add strFolder & fsoFile.Name Next .Display 'or 'Send End With Range("F" & i).Value = Format(Date, "mm/dd/yy") Next End With End Sub
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Thank you for the help.
Look me up on LinkedIn: https://www.linkedin.com/in/robbiedepalma/