Referencing distribution list code

  • Thread starter Todd Huttenstine
  • Start date
T

Todd Huttenstine

I have 2 codes here. The first one displays the
distribution list. The 2nd code sends emails to everyone
in that distribution list.

How do I make the following codes reference a distribution
list on a public directory called G:\test?


Heres the codes:
CODE 1:
Label2.SpecialEffect = fmSpecialEffectSunken
Dim MyOlApp As Outlook.Application
Dim MyNameSpace As Outlook.NameSpace
Dim MyFolder
Dim myItem
Dim MyDistMember As String

Set MyOlApp = New Outlook.Application
Set MyNameSpace = MyOlApp.GetNamespace("MAPI")
Set MyFolder = MyNameSpace.GetDefaultFolder
(olFolderContacts)
Set myItem = MyFolder.Items("Distribution B2B")

myItem.Display
Label2.SpecialEffect = fmSpecialEffectRaised

_____________________________________________

CODE 2 (Dont get the variable "Aol" mixed up with AOL
(America Online). Aol is just the name of the variable.

If CheckBox1.Value = True Then
'DistributionLists.DistributionBusiness
Set Aol = CreateObject("Outlook.Application")
Set AMailSendItem = Aol.CreateItem(AolMailItem)
Set AolApp = New Outlook.Application
Set AolContacts = AolApp.GetNamespace
("MAPI").GetDefaultFolder(olFolderContacts)
Set AdistList = AolContacts.Items("Distribution
B2B") '<---------- substitute name of dist list for "Plays"

AHyperLink = "<tr>" & vbCrLf & "<td>" & "<a href='"
& "http://webreports.south.vzwcorp.com/ngCatalog.asp?
EntryPoint=SO~W1"
AHyperLink = AHyperLink & intyear & ".com'>" & "<font
color=black><font
size=3>http://webreports.south.vzwcorp.com/ngCatalog.asp?
EntryPoint=SO~W1"

'"http://webreports.south.vzwcorp.com"
AszHTML = AszHTML & "<!DOCTYPE HTML PUBLIC ""-
//W3C//DTD HTML 4.0 Transitional//EN"">"
AszHTML = AszHTML & "<HTML><HEAD>"
AszHTML = AszHTML & "<META content=""text/html;
charset=iso-8859-1""http-equiv=Content-Type>"
AszHTML = AszHTML & "<META content=""MSHTML
5.00.2314.1000""name=GENERATOR></HEAD>"
AszHTML = AszHTML & "<DIV><IMG align=baseline
alt="""" border=0 hspace=0 "
AszHTML = AszHTML & "src=""G:\Sales OPs
CarTn\Reports\Templates\Verizon.gif""></DIV></BODY></HTML>"
'AszHTML = AszHTML & "Carolina/Tennessee Marketing
Update " & "</a></font ></b><br><BODY>" & "Metrics and
Analysis"
AszHTML = AszHTML & "<HTML><H2><font
color=black><font size=3>Carolina/Tennessee Marketing
Update" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3>Metrics and Analysis" & _
"</a></font ></b><br><BODY>" & _
"</a></font ></b><br><BODY>" & "<font
color=red><font size=3>***Please use NEW Link to web
reports included with this e-mail****" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3>Indirect Productivity has been
updated through " & EnteredDate & _
"</a></font ></b><br><BODY>" & _
"</a></font ></b><br><BODY>" & "<font
color=red><font size=3><U>Link to Web Reports</U>" & _
"</a></font ></b><br><BODY>" & _
AHyperLink & _
"</a></font ></b><br><BODY>" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3> Reports Include:" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=2> B2B Day over Day Sales_" &
AReportEnteredDate & ".xls" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=2> B2B Productivity Report_" &
AReportEnteredDate & ".xls" & _
"</a></font ></b><br><BODY>" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3> Please let me know if you have
any questions" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3> Thanks" & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3> Todd Huttenstine" & _
"</a></font ></b><br><BODY>" & "<font
color=red><font size=3> Verizon Wireless -
Carolina/Tennessee Region " & _
"</a></font ></b><br><BODY>" & "<font
color=red><font size=3> Marketing & Sales Operations-
Metric and Analysis " & _
"</a></font ></b><br><BODY>" & "<font
color=black><font size=3> Office: 864-987-2004" & _
"</a></font ></b><br><BODY>"
'<b>bold letters</B>
'"<body bgcolor=black>"
'<face=Arial>
' <a
href="mailto:[email protected]?
Subject=hypertest">Todd Huttenstine</a>
'AszHTML = AszHTML & AHyperLink
'Set Amsg = Application.CreateItem(AolMailItem)

For Ai = 1 To AdistList.MemberCount
Set AlistContact = AdistList.GetMember(Ai)
'Below code populates a listbox
'List1.AddItem AlistContact.Address
AEmailAddresses = AEmailAddresses &
AlistContact.Address & "; "
AMailSendItem.To = AEmailAddresses
Next

'AMailSendItem.To
= "(e-mail address removed)" & "; "
& "(e-mail address removed)"
AMailSendItem.Subject = "B2B Productivity -" &
BReportEnteredDate
AMailSendItem.HTMLBody = AszHTML
AMailSendItem.Send

Set AlistContact = Nothing
Set AdistList = Nothing
Set AolContacts = Nothing
Set AolApp = Nothing



Thanks
Todd Huttenstine
 
S

Sue Mosher [MVP-Outlook]

I'm not sure what you mean by "a public directory called G:\test." Outlook
doesn't have any native concept of public directories in the file system.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top