PC Review


Reply
Thread Tools Rate Thread

Code To Add "CC" Fails In 2002

 
 
David
Guest
Posts: n/a
 
      4th Mar 2005
Folks,

The following code works in Outlook 2000 to add someone to the CC field

of a message in Outlook 2000. It fails on the very last line of the
function in Outlook 2002. The names appear in the code as they
resolve. Commenting out the last line solves the issue in Outlook
2002, but then the message stays open after it sends. Anyone know why?


Function ufnSend1CC()

Dim NmSpc As NameSpace
Dim insp1 As Outlook.Inspector
Dim msg1 As Outlook.MailItem
Dim msg2 As Outlook.MailItem
Dim objRecipient As Outlook.Recipient

Set NmSpc = Application.GetNamespace("Mapi")
Set insp1 = Application.ActiveInspector

If insp1.CurrentItem.Class = olMail Then
Set msg1 = insp1.CurrentItem
Else
Exit Function
End If

If msg1.CC = "John Doe" Then

Set objRecipient = msg1.Recipients.Add("Richard Roe")
objRecipient.Type = olCC
Set msg2 = msg1.Copy

msg2.Send

msg1.Close olDiscard
ufnSend1CC = True
Else
ufnSend1CC = False
End If

End Function

Note: It is called like this:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Cancel = ufnSend1CC

End Sub

Thanks so much for your help!

David

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
Rules "Run Now" fails in OL 2002...? Kenneth Microsoft Outlook Discussion 9 10th Dec 2007 03:26 PM
Code To Add "CC" Fails In 2002 David Microsoft Outlook Discussion 0 4th Mar 2005 10:10 PM
Code To Add "CC" Fails In 2002 David Microsoft Outlook 0 4th Mar 2005 10:09 PM
Powerquest Drive Image 2002 fails due to inactive Maxtor "Disk Manager" or DDO Bob Alston Windows XP General 5 27th Dec 2003 08:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:11 PM.