Both, Word and Outlook is possible but if you have the code in Outlook 2003
running then there're no security prompts.
In OUtlook you can create a new e-mail with the CreateItem function. If all
the recipients should get the same message then simply add them all to the
MailItem's Recipients collection by calling Recipients.Add. The function
returns a Recipient object for which you can determine its type (olCC, olbCC
etc.). For plain text use the Body property else the HTMLBody property. Add
the attachment by calling Attachments.Add. That's it.

Signature
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --
Am Mon, 13 Nov 2006 21:09:01 -0800 schrieb adi:
> Hi,
> I am a novice at VBA programming but realised it is very powerful and useful.
[quoted text clipped - 8 lines]
>
> How can i do this? Please advise.
adi - 14 Nov 2006 18:45 GMT
Michael and Viele,
Thanks for your advise. I coded the following and it worked for me. However
teh problem i have is a dailog box is being displayed waiting for my input.
The e-mail is being sent only if i click the YES. I want to avoid/suppress
this msgbox. If suppression is not possible then i want to code in such a way
that the message box takes a default YES as if i clicked explicitly.
The message/dailog box reads.
"A program is trying to send an e-mail on your behalf.
Do you want to allow this?
If this is unexpected, this may be a virus and should choose NO."
How to suppress this dailog box? (if not atleast how to code so that it
takes YES as my default input)
Again thanks a lot for your time and appreciate your help.
Code that worked:
---------------------
Sub Macro3()
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem
Dim strContenu As String
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)
strContenu = "Email sent"
strContenu = strContenu + Chr(13) + Chr(10) + "next line"
Set myAttachments = oMail.Attachments
myAttachments.Add "C:\Adi\Atlas\atlas-calender.txt", olByValue, 1, "Fichier"
oMail.Body = strContenu
oMail.To = "adi.kondeti@morganstanley.com"
oMail.Subject = "testttttt"
oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub
> Both, Word and Outlook is possible but if you have the code in Outlook 2003
> running then there're no security prompts.
[quoted text clipped - 21 lines]
> >
> > How can i do this? Please advise.
Michael Bauer [MVP - Outlook] - 15 Nov 2006 05:51 GMT
That's the security dialog I've mentioned. If the code runs in Outlook 2003
then delete the Set oApp = ... line and for the rest of code replace oApp by
Application.
BTW: 'Viele Gruesse' is German and literally means 'Many Greetings', it's
not my or any other's name :-)

Signature
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --
Am Tue, 14 Nov 2006 10:45:01 -0800 schrieb adi:
> Michael and Viele,
> Thanks for your advise. I coded the following and it worked for me. However
[quoted text clipped - 63 lines]
>>>
>>> How can i do this? Please advise.
Viele Gruesse and Michael Bauer,
Thanks for your answer. It did help me understand how the process work. Can
you provide me a sample code as i am a novice in VBA programming. I do lot of
mainframe programming in Cobol. Also where do i write the piece of code? How
can i run it?
Please also suggest me a good book on MSWORD and MSOUTLOOK VBA programming.
Thanks for your time. Appreciate all your help.
Regards,
Adi
> Hi,
> I am a novice at VBA programming but realised it is very powerful and useful.
[quoted text clipped - 8 lines]
>
> How can i do this? Please advise.