Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Edgar
I can't reproduce your problem Send me your workbook private if you want. I maybe can find your problem then -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Edgar" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Questioin for Ron de Bruin | Excel Discussion (Misc queries) | |||
For Ron Bruin Please | Excel Worksheet Functions | |||
For Ron de Bruin Please | Excel Worksheet Functions | |||
for Ron de Bruin | Excel Programming | |||
A Question for Ron de Bruin | Excel Programming |