Email from Excel att: Ron de Bruin

E

Edgar

Hi

I am still having trouble with my macro which sends emails
from excel!!

I have fixed the cell offset values but it is not
attaching the correct files to the email message. What i
cant understand is it is attaching files that are not in
the directory that i am specifying on the sheet. How can
this happen? Does anyone have any ideas?? (Code below)Sub
TestFile1()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim cell As Range
Application.ScreenUpdating = False
Set olApp = New Outlook.Application
For Each cell In Sheets("Sheet1").Columns
("C").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 3).Value <> "" Then
If cell.Value Like "*@*" And Dir(cell.Offset
(0, 3).Value) <> "" Then
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = cell.Value
.Subject = "Testfile"
.Body = "Hi " & cell.Offset(0, -
1).Value
.Attachments.Add cell.Offset(0,
3).Value
.Display 'Or use Display
End With
Set olMail = Nothing
End If
End If
Next cell
Set olApp = Nothing
Application.ScreenUpdating = True
End Sub
 
R

Ron de Bruin

Hi Edgar

I can't reproduce your problem
Send me your workbook private if you want.
I maybe can find your problem then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top