CCkfm2000
04-16-2010, 04:38 AM
Hello,
I have folder with over 250 worksheets, I want to attach all worksheets with the same name to an email ready for emailing. Examples worksheet names below.
Appraisals fred.smith 14622
Appraisals fred.smith 14611
Appraisals fred.smith 14618
Appraisals john.bloggs 14641
Appraisals john.bloggs 14642
Appraisals john.bloggs 14643
Appraisals john.bloggs 14643
Appraisals john.bloggs 14644
Appraisals john.bloggs 14645
Appraisals Nigel.who14512
Some of the work sheets might be single files while others will be more.
I’ve got this code but can’t find a way to group the names together to email.
Sub create_email_for_editing()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
filedete = WorksheetFunction.CountA(Range("a1:a100"))
With olMail
.To = "name@domain.com"
.Subject = "email subject"
.Body = "email message"
.Attachments.Add "c:\eLearning data\*.xls", olByValue, 1
.Display
End With
End Sub
Thanks for the help
I have folder with over 250 worksheets, I want to attach all worksheets with the same name to an email ready for emailing. Examples worksheet names below.
Appraisals fred.smith 14622
Appraisals fred.smith 14611
Appraisals fred.smith 14618
Appraisals john.bloggs 14641
Appraisals john.bloggs 14642
Appraisals john.bloggs 14643
Appraisals john.bloggs 14643
Appraisals john.bloggs 14644
Appraisals john.bloggs 14645
Appraisals Nigel.who14512
Some of the work sheets might be single files while others will be more.
I’ve got this code but can’t find a way to group the names together to email.
Sub create_email_for_editing()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
filedete = WorksheetFunction.CountA(Range("a1:a100"))
With olMail
.To = "name@domain.com"
.Subject = "email subject"
.Body = "email message"
.Attachments.Add "c:\eLearning data\*.xls", olByValue, 1
.Display
End With
End Sub
Thanks for the help