Thread: Voting Button
View Single Post
  #8  
Old April 27th 06, 12:36 PM posted to microsoft.public.outlook.program_forms
DavidW
external usenet poster
 
Posts: 20
Default Voting Button

Hi Paul,

I think I must be doing something completely wrong! I've added the following
code to try and capture the voting button event:

Function Item_CustomAction(ByVal Action, ByVal NewItem)

Msgbox Action.Name

End Function

But this does not fire, all I get is the default 'Do you want to edit the
message before sending' prompt. I am trying to capture the event so that I
can test adding the recipients. When I publish the form all of the other code
works just not the Msgbox.

Any ideas?

Thanks
David

"Hollis Paul [MVP - Outlook]" wrote:

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
Function Item_Send()

Dim strVersion

Set cmbType = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("cmbType")
Set txtVersion = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("txtVersion")
strVersion = txtVersion.Value
[Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion

End Function

OK, it would appear that you are expecting your code to run after the receiver
has voted and is sending the reply back. In this case you want to add the
recipient object of type olOriginator back as a new recipient object and change
the type to olTo (see my other message for details). Then add a second
recipient object of type olTo with the fixed address that you want to use. Then
do a resolve as shown in this reply by Ken Slovak, except change the resolve to
ResolveAll.

***************************************
From: "Ken Slovak - [MVP - Outlook]"
Subject: Item.Recipients.Add Not Working for me
Date: Wed, 26 Apr 2006 09:54:12 -0400
Newsgroups: microsoft.public.outlook.program_forms


Does it work better if you instantiate a Recipient object and then resolve
it?

Set oRecip = ")
oRecip.Resolve

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
****************************************

Tip to the wise. The code line

Set oRecip = ")

creates a default recipient object. You want to use an explicit process:

dim omyRecipient
dim olTo = 0 '(or whatever it is)
set myoRecipient = Item.Recipients.Add
omyRecipient.Address = "
omyRecipient.Type = olTo

Another word to the wise. If you are going to be doing a significant amount of
Outlook forms design and programming, go to www.dimastr.com and buy a copy of
OutlookSpy and Outlook Redemption. It will save you a huge amount of trouble in
the future.



--
Hollis Paul
Mukilteo, WA USA



Ads