I have a number of excel workbooks stored in a folder. Most of these workbooks contain an email address in cell A3 (the rest have A3 as a blank cell). I need to email each workbook as an attachment along with a short message in the body of the email. Where a workbook doesn't contain an email address, it will be skipped.
I need a macro that can:
- Ask user to select the directory folder containing these files (that part is easy)
- Begin a loop on the workbooks in this folder and:
- If closed workbook has no email address in A3 then skip to next WB in folder (nice if it could append/prefix the file name with string NOT_SENT)
- If closed workbook has email address in A3 then:
- Start new email in Outlook
- Copy the email address from cell A3 to the To: field in Outlook
- Attach the closed workbook to the email
- Enter a short message in the body of the email (the message is to be hard coded in the VBA)
- Send the email and then repeat this loop with the next workbook in the folder
I realise that the above is quite an involved process however it can probably be broken down into smaller procedures (which is why I broke it down into a list).
I have no experience with working with closed workbooks nor with causing Excel VBA to interact with Outlook. Any assistance with even part of this code is appreciated.
Bookmarks