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 send email to list of individuals



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 10th 09, 04:45 PM posted to microsoft.public.outlook.program_vba
Jason
external usenet poster
 
Posts: 117
Default How to send email to list of individuals

I have the below code to generate an email, I would like to add a To: block
and take the list of receipiants from an excel spreadsheet that updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub

  #2  
Old February 10th 09, 05:28 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to send email to list of individuals


Assuming, Excel is already running, and the first address is in cell "a1":

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")

Now you can read Rn.Value for the first address, then loop through the rows
with the Offset function until the Value="".

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Tue, 10 Feb 2009 08:45:02 -0800 schrieb jason:

I have the below code to generate an email, I would like to add a To:

block
and take the list of receipiants from an excel spreadsheet that updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub

  #3  
Old February 10th 09, 05:41 PM posted to microsoft.public.outlook.program_vba
Jason
external usenet poster
 
Posts: 117
Default How to send email to list of individuals

I am really a novice at this, where do I place this code and how do I make it
loop?

"Michael Bauer [MVP - Outlook]" wrote:


Assuming, Excel is already running, and the first address is in cell "a1":

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")

Now you can read Rn.Value for the first address, then loop through the rows
with the Offset function until the Value="".

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Tue, 10 Feb 2009 08:45:02 -0800 schrieb jason:

I have the below code to generate an email, I would like to add a To:

block
and take the list of receipiants from an excel spreadsheet that updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub


  #4  
Old February 11th 09, 04:07 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to send email to list of individuals



The loop could look like this:

While Rn.Value""
.Recipients.Add Rn.Value
Set Rn=Rn.Offset(1,0)
Wend

Add the code to the With olMsg block.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Tue, 10 Feb 2009 09:41:05 -0800 schrieb jason:

I am really a novice at this, where do I place this code and how do I make

it
loop?

"Michael Bauer [MVP - Outlook]" wrote:


Assuming, Excel is already running, and the first address is in cell

"a1":

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")

Now you can read Rn.Value for the first address, then loop through the

rows
with the Offset function until the Value="".

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Tue, 10 Feb 2009 08:45:02 -0800 schrieb jason:

I have the below code to generate an email, I would like to add a To:

block
and take the list of receipiants from an excel spreadsheet that updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub


  #5  
Old February 13th 09, 03:53 PM posted to microsoft.public.outlook.program_vba
Jason
external usenet poster
 
Posts: 117
Default How to send email to list of individuals

Here is the code that I have, but I keep getting an error that says "user
defined type not defined. Any help would be appreciated

Sub Macro1()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem


Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem




Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("book1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")
While Rn.Value ""
.Recipients.Add Rn.Value
Set Rn = Rn.Offset(1, 0)
Wend

.CC = "xxx"
.Subject = "xxx"

.Display
.Body = "xxx" & .Body
.Body = "xxx" & .Body

.Attachments.Add "xxx"


End With
End Sub


"Michael Bauer [MVP - Outlook]" wrote:



The loop could look like this:

While Rn.Value""
.Recipients.Add Rn.Value
Set Rn=Rn.Offset(1,0)
Wend

Add the code to the With olMsg block.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Tue, 10 Feb 2009 09:41:05 -0800 schrieb jason:

I am really a novice at this, where do I place this code and how do I make

it
loop?

"Michael Bauer [MVP - Outlook]" wrote:


Assuming, Excel is already running, and the first address is in cell

"a1":

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")

Now you can read Rn.Value for the first address, then loop through the

rows
with the Offset function until the Value="".

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Tue, 10 Feb 2009 08:45:02 -0800 schrieb jason:

I have the below code to generate an email, I would like to add a To:
block
and take the list of receipiants from an excel spreadsheet that updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub


  #6  
Old February 13th 09, 04:40 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to send email to list of individuals



If you get the error for one of the Excel objects, you need to add a
reference to the Microsoft Excel x Object Library via Tools/References.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Fri, 13 Feb 2009 07:53:01 -0800 schrieb jason:

Here is the code that I have, but I keep getting an error that says "user
defined type not defined. Any help would be appreciated

Sub Macro1()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem


Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem




Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("book1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")
While Rn.Value ""
.Recipients.Add Rn.Value
Set Rn = Rn.Offset(1, 0)
Wend

.CC = "xxx"
.Subject = "xxx"

.Display
.Body = "xxx" & .Body
.Body = "xxx" & .Body

.Attachments.Add "xxx"


End With
End Sub


"Michael Bauer [MVP - Outlook]" wrote:



The loop could look like this:

While Rn.Value""
.Recipients.Add Rn.Value
Set Rn=Rn.Offset(1,0)
Wend

Add the code to the With olMsg block.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Tue, 10 Feb 2009 09:41:05 -0800 schrieb jason:

I am really a novice at this, where do I place this code and how do I

make
it
loop?

"Michael Bauer [MVP - Outlook]" wrote:


Assuming, Excel is already running, and the first address is in cell

"a1":

Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim Rn As Excel.Range

Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

Set Rn = Ws.Range("a1")

Now you can read Rn.Value for the first address, then loop through the

rows
with the Offset function until the Value="".

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Tue, 10 Feb 2009 08:45:02 -0800 schrieb jason:

I have the below code to generate an email, I would like to add a To:
block
and take the list of receipiants from an excel spreadsheet that

updates
daily. How can this be done.

Sub Macro1()



Dim olApp As Outlook.Application

Dim olMsg As Outlook.MailItem



Set olApp = Outlook.Application

Set olMsg = olApp.CreateItem(olMailItem)



With olMsg



.Subject = "Hello world"

.Display

.Body = "Hello, here is my email!" & .Body

End With



Set olMsg = Nothing

Set olApp = Nothing

End Sub


 




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
how do I send a bulk email & protect indentity of individuals Booky7 Outlook - Using Contacts 5 September 9th 08 09:45 AM
How does one show the distribution list name, but not individuals. wynswid Outlook - Using Contacts 2 April 10th 07 06:14 PM
Extracting individuals from a Distribution List SpencerMC Outlook - Using Contacts 1 October 12th 06 02:10 PM
distribution list under E-MAIL TYPE has MAPIPDL individuals stmp Level Outlook - Using Contacts 0 September 13th 06 06:18 PM
can send to individuals - not group Steelcity Gal Outlook - Using Contacts 2 February 7th 06 06:33 PM


All times are GMT +1. The time now is 10:42 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.