DLName Property

Microsoft Outlook Visual Basic

Returns or sets a String representing the display name of a distribution list. Read/write.

expression.DLName

expression    Required. An expression that returns a DistListItem object.

Example

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example creates a new distribution list and then prompts the user for a name.

Sub CreateDL()
	Dim myOlApp As New Outlook.Application
	Dim myDistList As Outlook.DistListItem
	Set myDistList = myOlApp.CreateItem(olDistributionListItem)
	myDistList.DLName = InputBox("Type the name of the new distribution list.")
	myDistList.Save
	myDistList.Display
End Sub
		

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

Set myDistList = Application.CreateItem(7)
myDistList.DLName = _
    InputBox("Type the name of the new distribution list.")
myDistList.Save
myDistList.Display