Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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 11:02 AM
User Defined Function niravp SQL Server 2000 7 November 29th, 2004 01:18 PM
Sub or Function Not Defined Olivia54 Access VBA 4 July 10th, 2004 01:56 PM



All times are GMT -4. The time now is 05:14 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.