I am new to VBA and I have read “outlook 2007 programming”. When I run the code below (the code is from the book) I receive a compile error, "Sub or Function not defined." And the “Public Sub AddRecipient()” gets Highlighted. Also “SetDefaultDisplayMode_” is highlighted with a blue background. Can someone tell me what the problem may be?
Public Sub AddRecipient()
Dim oSelect As Outlook.SelectNamesDialog
Dim colRecipients As Outlook.Recipients
Dim oRecip As Outlook.Recipient
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
Set oSelect = Application.Session.GetSelectNamesDialog
.AllowMultipleSelection = False
.ForceResolution = True
.Caption = "My Mail Selector Dialog"
.ToLabel = "My To Selector"
.NumberOfRecipientSelectors = _
If .Recipients.Count = 1 Then
Set oRecip = _
Thank you in advance for your help