View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Safi. Safi. is offline
external usenet poster
 
Posts: 12
Default Email Booster from Excel


Sir,

I have gone through the page of your site which makes EXCEL to send
E-mail..which had opened my eyes against excel as it has immense power which
i have often ignored but when i come accross this particular idea of sending
Email through ms-outlook and excel..I have changed your VBA code to suit my
needs...as i have to report and want various reports from others i was glued
to ms-outlook. but due to typing and making my point more in force i used to
type each one..but ur simple code makes this possible and solved so many
hours of hardwork..thanks a lot.

Please have a look into the code which i have altered and help me in getting
more reinforced...thanks in advance.

My Data is like this :

A B C D E F
Name Email Criteria Subject Matter Attachment


The Code I have altered:

ub TestFile()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

On Error GoTo cleanup
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(x lCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) =
"yes" Then
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = cell.Offset(A2).Value

.Subject = cell.Offset(0, 2).Value

.Body = "Dear " & cell.Offset(0, -1).Value & vbNewLine &
vbNewLine & cell.Offset(0, 3).Value

'You can add files also like this
.Attachments.Add (cell.Offset(0, 4).Value)
.Send 'Or use Display
End With
On Error GoTo 0

Set OutMail = Nothing
End If
Next cell

cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub



The Issues I want to solve and make this more powerful is that

1.Instead of yes/no in criteria I wanted have it compared with date if the
date and time matches to todays date and time then "yes" else no.

2.Browse for the attachment rather than typing a long file path in cell as
it is very difficult to remember the lengthy complete file path (shall we
make it for browse for a file then select)

3.if the date and time matches to todays date and time even though the excel
& outlook are not opened then also it must mail to the relevant email..some
sort of like startup..(nternet SMTP servers are 24 hours on. making
indenpendent.
(i fill mail id, subject and matter and date and time in criteria for a
month so that even i my absense the person from whom i want a report shuld
get my reminder keeping in view that my computer is always on)

the same when expressed briefly
1. criteria will be date and time
2. browse for the file to attach
3. run background and mail against the matched date and time mentioned in
excel.

Hope to get solution for this...

Thanking you,
safi.