OK, I've starated to write it in excel. However, I'm a
complete novice when it comes to outlook coding, so most
of what I've got here I've just pasted from help pages in
outlook.
Here's the code. It crashes on the first line (great
start, huh?), saying "User-defined type not defined"...
Sub emailcamp()
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myDistList As Outlook.DistListItem
Dim myTempItem As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myDistList = myOlApp.CreateItem(olDistributionListItem)
Set myTempItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myTempItem.Recipients
myDistList.DLName = "LDQuestionnaire"
Workbooks("ldvip.xls").Activate
Range("b1").Select
For x = 1 To 4000
email = ActiveCell.Value
myOlApp.ActiveWindow
myDistList.AddMembers email
myDistList.Display
Workbooks("ldvip.xls").Activate
ActiveCell.Offset(1, 0).Activate
Next x
End Sub
Hopefully what I'm trying to do here is self-explanatory,
if incorrect!
Thanks for your help,
Lawrence
-----Original Message-----
Can you post your code?
Actually, it would probably make more sense to code this
macro in Excel, as this is the contextual source of the
information. For instance, you can prevent the code from
running unless a proper range (containing the e-mail
addresses) has been selected, the worksheet is open, etc.