LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Email from Excel

[To maximize your chances for meaninful answers, you should create a
new thread for a new subject.]

Cursory reading of your code suggest that Offset(0,1) can't be right
if you want to attach the file specified in column F.

Why do you hinge your "For Each cell"-loop on column B?

On Sun, 25 Jan 2004 08:22:21 -0800, "Edgar"
wrote in
microsoft.public.excel.programming:

Hi

I use the following code to send emails from Excel. The
sheet that it uses has the following columns:

SuppID Name Email Curr Amount File Location
112585 AAA AUD 3000 C:\remit\112585.msg
112652 BBB
, NZD 5000 c:\remit\112652.msg

When i run the code it checks that there is an email
address in column C and a file location in column F and
then loops through the items sending an email with the
data in the list. I have used this before but i changed
the layout of the sheet to add some extra columns and
adjusted the offset values in the code but now when I run
the code it doesnt pick up the right file as an
attachment. Can anyone spot why this is happening?

Thanks in advance

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
("B").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 = "Testfile"
.Body = "Hi " & cell.Offset(0, -
1).Value
.Attachments.Add cell.Offset(0,
1).Value
.Display 'Or use Display
End With
Set olMail = Nothing
End If
End If
Next cell
Set olApp = Nothing
Application.ScreenUpdating = True
End Sub


--
Michael Bednarek
http://mbednarek.com/ "POST NO BILLS"
 
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:49 PM.

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

About Us

"It's about Microsoft Excel"