Thread: Voting button
View Single Post
  #7  
Old April 13th 06, 09:11 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Voting button

Comments inline

"stanhope4" wrote in message ups.com...
Function Item_CustomAction(ByVal Action, ByVal NewItem)

select case Action.Name
case "Approve"
Set Newitem = Application.CreateItem(olMailItem)


Why are you creating a new message here? NewItem is already a response created by the custom action.

item.userproperties.find("Approve") = true
Actions.Item("Approve").Enabled = True
Actions.Item("Deny").Enabled = True


IIRC, the above two statements will one-off the current item so that it will never run code again. I'd recommend you remove them.

Newitem.subject = "Holiday Request Approved"
NewItem.Body = "Your request from"
&(item.userproperties.find("HolidayStart")) &
" to " & (item.userproperties.find("HolidayEnd")) & "for
" & (item.userproperties.find("totaldays"))& " days leave has been
approved."

case "Deny"
item.userproperties.find("Deny") = true
Actions.Item("Approve").Enabled = True
Actions.Item("Deny").Enabled = True


Ditto.

Newitem.subject "Holiday Request Denied"
NewItem.Body = "Your request from " &
(item.userproperties.find("HolidayStart")) &
" to " & (item.userproperties.find("HolidayEnd")) & "for
" & (item.userproperties.find("Totaldays"))& " days leave has been
denied."
end select

item.close(0)

Item_CustomAction = true


The above statement is unneccessary. If you wanted to suppress the NewItem created by the action, you'd set the return value to False.

If you want to show the message created by the action, you need to include a NewItem.Display statement.

end function

line " NewItem.Body = "Your request from"
&(item.userproperties.find("HolidayStart")) &" is coming up with error
'syntax error' when i run the form.


You need a space between the ampersand $ and the parenthesis.

have 2 buttons approve and deny and i want to create a new email when
relevent button is pressed to create a new email with the relevent data
in the email body.

Ads