A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to write a program/macro to send a mail to a groups of e-mail



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 14th 06, 07:45 PM posted to microsoft.public.outlook.program_vba
Adi
external usenet poster
 
Posts: 9
Default How to write a program/macro to send a mail to a groups of e-m

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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To address(b)Subject(d)BCC(e)CC(f)Document to
send as attatchment(g)e-mail body, how to write a program that can send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while trying

to
open a doc and send e-mail. But the macro does not give any details about

the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.


  #2  
Old November 15th 06, 06:51 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to write a program/macro to send a mail to a groups of e-m


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 :-)

--
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
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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To address(b)Subject(d)BCC(e)CC(f)Document to
send as attatchment(g)e-mail body, how to write a program that can send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while trying

to
open a doc and send e-mail. But the macro does not give any details

about
the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.


  #3  
Old November 30th 06, 11:40 PM posted to microsoft.public.outlook.program_vba
Adi
external usenet poster
 
Posts: 9
Default How to write a program/macro to send a mail to a groups of e-m

Michael,
Thanks a lot. I coded as you advised and it worked in Outlook.
However if i coded the same in MSWORD, i get the following error
Compile Error. Method or Datamember not found. at line
Set oMail = Application.CreateItem(olMailItem)

How do i refer outlook objects from word?

My code: (that worked in outlook editor)
Sub macro1()
Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add "C:\Documents and Settings\Cholu\Desktop\What the Holidays
Mean To Me.doc", olByValue, 1, "Fichier"
oMail.To = "
oMail.Subject = "testttttt"
oMail.Send
End Sub
"Michael Bauer [MVP - Outlook]" wrote:

Regards,
Adi

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 :-)

--
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
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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To address(b)Subject(d)BCC(e)CC(f)Document to
send as attatchment(g)e-mail body, how to write a program that can send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while trying
to
open a doc and send e-mail. But the macro does not give any details

about
the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.


  #4  
Old December 1st 06, 07:41 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to write a program/macro to send a mail to a groups of e-m



In Word the Application object refers to Word.Application not
Outlook.Application. There's no documented way to use Outlook's intrinsic
Application object from outside. Maybe you can redesign your solution?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Thu, 30 Nov 2006 14:40:06 -0800 schrieb Adi:

Michael,
Thanks a lot. I coded as you advised and it worked in Outlook.
However if i coded the same in MSWORD, i get the following error
Compile Error. Method or Datamember not found. at line
Set oMail = Application.CreateItem(olMailItem)

How do i refer outlook objects from word?

My code: (that worked in outlook editor)
Sub macro1()
Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add "C:\Documents and Settings\Cholu\Desktop\What the

Holidays
Mean To Me.doc", olByValue, 1, "Fichier"
oMail.To = "
oMail.Subject = "testttttt"
oMail.Send
End Sub
"Michael Bauer [MVP - Outlook]" wrote:

Regards,
Adi

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 :-)

--
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
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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To address(b)Subject(d)BCC(e)CC(f)Document

to
send as attatchment(g)e-mail body, how to write a program that can

send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while

trying
to
open a doc and send e-mail. But the macro does not give any details

about
the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.


  #5  
Old December 2nd 06, 07:11 AM posted to microsoft.public.outlook.program_vba
Adi
external usenet poster
 
Posts: 9
Default How to write a program/macro to send a mail to a groups of e-m

Hi,
In my following code in outlook, i am trying to e-mail a document. Before
e-mailing i want to parse the document, get the 4th line, 10th position to
the end(this will give me teh fax number) and then e-mail the same document
to .


Public Sub test1()
PathToUse = "C:\Documents and Settings\Adi\My Documents\Test\"

myFile = Dir$(PathToUse & "*.doc")
While myFile ""

Set Word = Application.CreateObject("Word.Application")----- LINE-2

MyVar = Mid$(ActiveDocument.Paragraphs(4).Range, 10) -----LINE-1

Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add PathToUse & myFile, olByValue, 1, "Fichier"
oMail.To = "
'oMail.To = "
oMail.Subject = "testttttt"
oMail.Send

myFile = Dir$()

Wend
End Sub

Question:
How to code so that in LINE-1 in above code, ActiveDocument actually points
to myFile. Does LINE-2 is needed? Again I am new to VBA.

Thanks for your help.

Regards,
Adi


"Michael Bauer [MVP - Outlook]" wrote:



In Word the Application object refers to Word.Application not
Outlook.Application. There's no documented way to use Outlook's intrinsic
Application object from outside. Maybe you can redesign your solution?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
--
www.VBOffice.net --

Am Thu, 30 Nov 2006 14:40:06 -0800 schrieb Adi:

Michael,
Thanks a lot. I coded as you advised and it worked in Outlook.
However if i coded the same in MSWORD, i get the following error
Compile Error. Method or Datamember not found. at line
Set oMail = Application.CreateItem(olMailItem)

How do i refer outlook objects from word?

My code: (that worked in outlook editor)
Sub macro1()
Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add "C:\Documents and Settings\Cholu\Desktop\What the

Holidays
Mean To Me.doc", olByValue, 1, "Fichier"
oMail.To = "
oMail.Subject = "testttttt"
oMail.Send
End Sub
"Michael Bauer [MVP - Outlook]" wrote:

Regards,
Adi

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 :-)

--
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
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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To address(b)Subject(d)BCC(e)CC(f)Document

to
send as attatchment(g)e-mail body, how to write a program that can

send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while

trying
to
open a doc and send e-mail. But the macro does not give any details
about
the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.



  #6  
Old December 4th 06, 07:20 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to write a program/macro to send a mail to a groups of e-m


Please create the Word Application object once outside the loop. The open
the files with the Word.Documents.Open function. That returns a Document
object, use that instead of ActiveDocument.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Fri, 1 Dec 2006 22:11:00 -0800 schrieb Adi:

Hi,
In my following code in outlook, i am trying to e-mail a document. Before
e-mailing i want to parse the document, get the 4th line, 10th position to
the end(this will give me teh fax number) and then e-mail the same

document
to .


Public Sub test1()
PathToUse = "C:\Documents and Settings\Adi\My Documents\Test\"

myFile = Dir$(PathToUse & "*.doc")
While myFile ""

Set Word = Application.CreateObject("Word.Application")----- LINE-2

MyVar = Mid$(ActiveDocument.Paragraphs(4).Range, 10) -----LINE-1

Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add PathToUse & myFile, olByValue, 1, "Fichier"
oMail.To = "
'oMail.To = "
oMail.Subject = "testttttt"
oMail.Send

myFile = Dir$()

Wend
End Sub

Question:
How to code so that in LINE-1 in above code, ActiveDocument actually

points
to myFile. Does LINE-2 is needed? Again I am new to VBA.

Thanks for your help.

Regards,
Adi


"Michael Bauer [MVP - Outlook]" wrote:



In Word the Application object refers to Word.Application not
Outlook.Application. There's no documented way to use Outlook's intrinsic
Application object from outside. Maybe you can redesign your solution?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
--
www.VBOffice.net --

Am Thu, 30 Nov 2006 14:40:06 -0800 schrieb Adi:

Michael,
Thanks a lot. I coded as you advised and it worked in Outlook.
However if i coded the same in MSWORD, i get the following error
Compile Error. Method or Datamember not found. at line
Set oMail = Application.CreateItem(olMailItem)

How do i refer outlook objects from word?

My code: (that worked in outlook editor)
Sub macro1()
Set oMail = Application.CreateItem(olMailItem)
Set myAttachments = oMail.Attachments
myAttachments.Add "C:\Documents and Settings\Cholu\Desktop\What the

Holidays
Mean To Me.doc", olByValue, 1, "Fichier"
oMail.To = "
oMail.Subject = "testttttt"
oMail.Send
End Sub
"Michael Bauer [MVP - Outlook]" wrote:

Regards,
Adi

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 :-)

--
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
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 = "
oMail.Subject = "testttttt"

oMail.Send
oApp.Quit
Set oApp = Nothing
End Sub


"Michael Bauer [MVP - Outlook]" wrote:


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.

--
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.
I have a need to send e-mails to 10 different id's.
Given a (a)from address (b)To

address(b)Subject(d)BCC(e)CC(f)Document
to
send as attatchment(g)e-mail body, how to write a program that can

send
e-mails automatically just by running it?
Is it easier to do it from Word or from Outlook.?
I tried to record and look at the macro that Word generates while

trying
to
open a doc and send e-mail. But the macro does not give any details
about
the
mail specifics. It just has ActiveDocument.SendMail.

How can i do this? Please advise.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to send a mail from drafts Varun Nair Outlook and VBA 1 August 23rd 06 03:48 PM
How to program a macro to do a mail merge. mjj4golf Outlook and VBA 1 July 19th 06 11:24 PM
Send Mail to Outlook from a Program jerry Outlook - General Queries 4 July 3rd 06 03:25 PM
$$ looking for someone to write a macro for me [email protected] Outlook and VBA 0 March 16th 06 12:24 AM
A program is trying to send mail using Item.Send Vitesh Outlook and VBA 1 January 23rd 06 03:25 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.