![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |