A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Voting button



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 10th 06, 01:51 PM posted to microsoft.public.outlook.program_vba
stanhope4
external usenet poster
 
Posts: 5
Default Voting button

Function Item_CustomAction(ByVal Action, ByVal NewItem)

select case Action.Name
case "Approve"
Set Newitem = Application.CreateItem(olMailItem)
item.userproperties.find("Approve") = true
Actions.Item("Approve").Enabled = True
Actions.Item("Deny").Enabled = True
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
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

end function

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

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.

  #2  
Old April 11th 06, 12:44 PM posted to microsoft.public.outlook.program_vba
stanhope4
external usenet poster
 
Posts: 5
Default Voting button

i have managed to change the code slightly so that the syntax error
doesn't occur but when clicking the approve button it still doesn't
create an email as coded?! still stuck!

  #3  
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.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attachment button Zakattack Outlook - Installation 3 March 28th 06 03:34 AM
missing voting buttons, missing response toolbar [email protected] Outlook - General Queries 4 March 1st 06 05:49 PM
Automation of voting buttons [email protected] Outlook - Using Forms 0 February 2nd 06 02:09 PM
How do I set up a voting buttons with hyperlink? Sunny Outlook - General Queries 1 January 24th 06 03:51 PM
Outlook 2003 Voting Problem [email protected] Outlook - General Queries 0 January 23rd 06 10:48 PM


All times are GMT +1. The time now is 07:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.