'******************************************************************************* ' Distribution List Generator v0.1 ' ' Jeremy Edmiston (JeremyEdmiston@PointLoma.edu) ' Point Loma Nazarene University ' ' Modified 09/20/2006 '******************************************************************************* ' ' Purpose: To create an Outlook Distribution List from a text file ' ' Usage: When executed, will browse for a file ' Can be called with file path as parameter for auto-creation ' ' File: The file to be loaded must contain one name per row with the format: ' [FirstName] [LastName] [EmailAddress] ' or [Name] [EmailAddress] ' or [EmailAddress] ' ' Warning: Outlook Security will prompt to allow access, this is by design ' '******************************************************************************* On Error Resume Next 'Check for parameter Set objArgs = WScript.Arguments if objArgs.Count = 0 then Set oFileBrowser = CreateObject("UserAccounts.CommonDialog") oFileBrowser.ShowOpen oFile = oFileBrowser.FileName else oFile = objArgs(0) end if 'Instatiate Outlook Set oApp = Wscript.CreateObject("Outlook.Application") 'Create the Distribution List Object Set oDL = oApp.CreateItem(7) 'Create a mail item (DL do not allow direct access to members by design) Set oMail = oApp.CreateItem(olMailItem) Set oRecip = oMail.Recipients 'Open file and process records Set objFSO = CreateObject("Scripting.FileSystemObject") Set FS = objFSO.OpenTextFile(oFile,1) i = 0 Do While FS.AtEndOfStream <> True strNextLine = FS.Readline oRecip.Add strNextLine i = i + 1 Loop FS.Close 'Add members from the mail recipients oDL.AddMembers oRecip oDL.display() Wscript.Quit