![]() |
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
|
|||
|
|||
![]()
Hi,
I currently have two voting buttons setup 'approve' and 'deny', i am trying to code (a bit of a novice) so that when i click the apprioriate button it opens a new email containing relevent information from a previous form. below is the code: select case Action.Name case "Approval" Set Newitem = Application.CreateItem(olMailItem) item.userproperties.find("Approve") = true Actions.Item("Approve").Enabled = False Actions.Item("Deny").Enabled = False NewItem.Body = "Your request from" & (item.userproperties.find("txtHolStart")) & " to " & (item.userproperties.find("txtHolEnd")) & "for " & (item.userproperties.find("totaldays"))& " days leave has been approved." case "Deny" item.userproperties.find("Denied") = true Actions.Item("Approve").Enabled = False Actions.Item("Deny").Enabled = False NewItem.Body = "Your request from " & (item.userproperties.find("txtHolStart")) & " to " & (item.userproperties.find("txtHolEnd")) & "for " & (item.userproperties.find("Totaldays"))& " days leave has been denied." end select item.close(0) Item_CustomAction = true not sure what im doing wrong but i keep getting a 'syntax error' on the line : NewItem.Body = "Your request from" & (item.userproperties.find("txtHolStart")) & also i would like to add reciepients into this email so any help with that would be much appricated! Thanks in advance. |
#2
|
|||
|
|||
![]()
txtHolStart sounds like the name of a control, not a custom property. They use different syntaxes; see http://www.outlookcode.com/d/propsyntax.htm
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stanhope4" wrote in message oups.com... Hi, I currently have two voting buttons setup 'approve' and 'deny', i am trying to code (a bit of a novice) so that when i click the apprioriate button it opens a new email containing relevent information from a previous form. below is the code: select case Action.Name case "Approval" Set Newitem = Application.CreateItem(olMailItem) item.userproperties.find("Approve") = true Actions.Item("Approve").Enabled = False Actions.Item("Deny").Enabled = False NewItem.Body = "Your request from" & (item.userproperties.find("txtHolStart")) & " to " & (item.userproperties.find("txtHolEnd")) & "for " & (item.userproperties.find("totaldays"))& " days leave has been approved." case "Deny" item.userproperties.find("Denied") = true Actions.Item("Approve").Enabled = False Actions.Item("Deny").Enabled = False NewItem.Body = "Your request from " & (item.userproperties.find("txtHolStart")) & " to " & (item.userproperties.find("txtHolEnd")) & "for " & (item.userproperties.find("Totaldays"))& " days leave has been denied." end select item.close(0) Item_CustomAction = true not sure what im doing wrong but i keep getting a 'syntax error' on the line : NewItem.Body = "Your request from" & (item.userproperties.find("txtHolStart")) & also i would like to add reciepients into this email so any help with that would be much appricated! Thanks in advance. |
#3
|
|||
|
|||
![]()
i have changed the name of the control to reflect the names i have used
in the all fields tab and it still comes up with the same syntax error!! as i said i'm a novice but looking around the net it appears that i'm using the correct code?! any help would be appricated. |
#4
|
|||
|
|||
![]()
Show your new code please and indicate what statement(s) are raising errors.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stanhope4" wrote in message oups.com... i have changed the name of the control to reflect the names i have used in the all fields tab and it still comes up with the same syntax error!! as i said i'm a novice but looking around the net it appears that i'm using the correct code?! any help would be appricated. |
#5
|
|||
|
|||
![]()
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. |
#6
|
|||
|
|||
![]()
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! |
#7
|
|||
|
|||
![]()
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 |