Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5
This is the forum to discuss the Wrox book Professional Outlook 2007 Programming by Ken Slovak; ISBN: 9780470049945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2012, 09:02 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sub or Function not defined

Hello
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?


Code:
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
 With oSelect
  .AllowMultipleSelection = False
  SetDefaultDisplayMode _
    OlDefaultSelectNamesDisplayMode.olDefaultMail
   .ForceResolution = True
   .Caption = "My Mail Selector Dialog"
   .ToLabel = "My To Selector"
   .NumberOfRecipientSelectors = _
     OlRecipientSelectors.olShowTo
   .Display
   If .Recipients.Count = 1 Then
     Set oRecip = _
       oMail.Recipients.Add(.Recipients.Item(1).Name)
   End If
End With
oMail.Display
End Sub]

Thank you in advance for your help




Similar Threads
Thread Thread Starter Forum Replies Last Post
Go for View or User Defined function vinod_yadav1919 SQL Server 2000 1 December 12th, 2007 05:18 AM
Help : compile error : sub or function not defined Specialist VB How-To 2 June 20th, 2007 04:34 AM
error function not defined Dj Kat Ajax 6 March 6th, 2006 12:02 PM
User Defined Function niravp SQL Server 2000 7 November 29th, 2004 02:18 PM
Sub or Function Not Defined Olivia54 Access VBA 4 July 10th, 2004 01:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.