Share via


AddressBookName Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns or sets a String that indicates the Address Book name for the current **MAPIFolder**object. Read/write.

expression.AddressBookName

expression   Required. An expression that returns a MAPIFolder object.

Example

The following example changes the Address Book name for a given folder and displays the new name to the user. The subroutine accepts the folder object and a String representing the new folder name.

  Sub BookName()

    Dim olApp As Outlook.Application
    Dim nmsName As NameSpace
    Dim fldFolder As MAPIFolder
    Dim strAns As String

    Set olApp = Outlook.Application
    'Create a reference to namepsace
    Set nmsName = olApp.GetNamespace("MAPI")
    'Create an instance of the Contacts folder
	Set fldFolder = nmsName.GetDefaultFolder(olFolderContacts)

    'Prompt user for input
    strAns = InputBox("Enter the name of the new address book")
    'Call Sub procedure
    Call Changebook(fldFolder, strAns)

End Sub

Sub Changebook(ByRef fldFolder As MAPIFolder, ByVal strName As String)
'Changes the name of the address book for a given folder

    'Set address book name to user input
    fldFolder.AddressBookName = strName
    'Display message to user
    MsgBox ("The new address book name for the " & fldFolder.Name & " folder is " _
             & strName & ".")

End Sub