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 6th 06, 05:49 PM posted to microsoft.public.outlook.program_vba
stanhope4
external usenet poster
 
Posts: 5
Default Voting button

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  
Old April 6th 06, 06:11 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Voting button

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  
Old April 10th 06, 09:58 AM posted to microsoft.public.outlook.program_vba
stanhope4
external usenet poster
 
Posts: 5
Default Voting button

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  
Old April 10th 06, 01:19 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Voting button

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

  #6  
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!

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

 




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.