PDA

View Full Version : Email from excel



anandbohra
08-11-2008, 01:54 AM
Hi all
before posting this thread I had googled the code for the same & also searched this site but everywhere I found only these lines

Set OutApp = CreateObject("Outlook.Application")


the problem is it activates Microsoft Outlook & not Outlook express
for this I checked my Internet explorer settings & also default E-Mail handler; which is Oulook express.

now pl suggest me what should I do to send mails from Outlook Express.
As everyday our research team have to send 100-150 mails with Files as attachement & common message body & subject matter so I got the idea of sending mails through Excel VBA but I am stuck to this outlook problem

pl solve this & guide me how to set outlook express for sending mails instead of Microsoft outlook.

marshybid
08-11-2008, 03:00 AM
Hi there,

Have a look at the article in the link below. I had to try to do something very similar a while ago and found it very useful. I take absolutely no credit for it :o)

http://www.j-walk.com/SS/excel/tips/tip86.htm

Marshybid

anandbohra
08-11-2008, 03:32 AM
Thanks for the reply
but my requirement is
send Mails from excel using outlook express
should add to or cc or bcc as pe my requirements
should be able to attach file (path will be given)

like I want the columner excel sheet cotaining to, cc, bcc, subject, body, attachment columns one should add one by one data & finally macro should mail the same as per given data

hope u r clear now.

awaiting for an earliest reply

Kenneth Hobs
08-11-2008, 06:21 AM
See if this addin helps. http://www.rondebruin.nl/mail/add-in.htm

anandbohra
08-11-2008, 11:57 PM
I tried this also but not as per my requirement
I want to create small database in EXCEL (WHICH I ALREADY HAVE)
containing following columns
TO -- CC -- BCC -- SUBJECT -- Message body -- Attachment (path of file)

then I will write all email address one below other then my macro (of course you genius people help me in the same) run through all cells & send the MAIL one after one with the given path & attach the file in message


& other thing is I found the code which almost do the same ( in this site www.rondebruin.nl ) but it uses Microsoft Outlook & also promt for yes so it will be impossible to click yes every 150 times (my general mailing list people)


pl help me with the suggestions




the code is below mentioned ( taken from above mentioned site)

Option Explicit

Sub Send_Files()
Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim cell As Range, FileCell As Range, rng As Range

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set sh = Sheets("SendFiles")

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

For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)

'Enter the file names in the C:Z column in each row
Set rng = sh.Cells(cell.Row, 1).Range("C1:Z1")

If cell.Value Like "?*@?*.?*" And _
Application.WorksheetFunction.CountA(rng) > 0 Then
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = cell.Value
.Subject = "Testfile"
.Body = "Hi " & cell.Offset(0, -1).Value

For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
If Trim(FileCell) <> "" Then
If Dir(FileCell.Value) <> "" Then
.Attachments.Add FileCell.Value
End If
End If
Next FileCell

.Display 'Or use Send
End With

Set OutMail = Nothing
End If
Next cell

Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub



the above code use Microsoft Outlook & not Outlook Express

which reference will use outlook express instead of Microsoft Outlook thats what I want

anandbohra
08-25-2008, 03:38 AM
After thoroughly scanning the site contents (earlier told from where I got the code) my problem is solved to the extent of 95% means now If I use the office 2007 (outlook 2007) there is no problem at all & my email alongwith attachment, CC, BCC, To etc etc goes as per my requirement. ie. one click & bingo message goes to all in flash of time.

but now I stuck to solve the same in office 2003.

bye will keep all of u updated on my findings & working.

& will post the final file once it is ready eiter to work in outlook express (incorporate external file as attachment) or in Microsoft outlook without prompting for user interuption before mail sending.

bye