Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Email from Excel

Hello....

I ahve found the following code from Ron de Bruin's
website which works well. I was wondering if anyone has
extended this to handle any errors?

As I am emailing 100's of files and these get imported
with another macro sometimes the macro falls down due to
their not being an email address or file name in the
respective cells. What I would like is if there is
somekind of error for the report to carry on to the next
item.

Cheers

Going going gone Ronnie

Sub Email_Remit()
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, 1).Value < "" Then
If cell.Value Like "*@*" And Dir(cell.Offset
(0, 1).Value) < "" Then
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = cell.Value
.Subject = "File Send"
.Body = "Please see the attached file"
.Attachments.Add cell.Offset(0,
1).Value
.Display
End With
Set olMail = Nothing
End If
End If
Next cell
Set olApp = Nothing
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Email from Excel

Hi Ronnie

It is checking for a E-mail Addres and if tehre is a file in the column and if
it exist?
It will loop through all cells


Maybe you have set the Offset wrong?


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ronnie" wrote in message ...
Hello....

I ahve found the following code from Ron de Bruin's
website which works well. I was wondering if anyone has
extended this to handle any errors?

As I am emailing 100's of files and these get imported
with another macro sometimes the macro falls down due to
their not being an email address or file name in the
respective cells. What I would like is if there is
somekind of error for the report to carry on to the next
item.

Cheers

Going going gone Ronnie

Sub Email_Remit()
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, 1).Value < "" Then
If cell.Value Like "*@*" And Dir(cell.Offset
(0, 1).Value) < "" Then
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = cell.Value
.Subject = "File Send"
.Body = "Please see the attached file"
.Attachments.Add cell.Offset(0,
1).Value
.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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
send email to each customer email in excel sheet. -keevill- Excel Discussion (Misc queries) 3 July 17th 08 02:33 PM
Email addresses in Excel need to format for mass email Boomer Excel Worksheet Functions 1 June 9th 06 01:46 PM
Email editor closes when forwarding Excel-embedded email Bambina Setting up and Configuration of Excel 0 March 16th 06 10:45 PM
working on excel document in email saved changes in email not in . butter Excel Discussion (Misc queries) 2 February 20th 06 09:25 AM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM


All times are GMT +1. The time now is 11:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"