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 - Using Forms
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 24th 06, 07:25 PM posted to microsoft.public.outlook.program_forms
DavidW
external usenet poster
 
Posts: 20
Default Voting Button

I have created a custom form and am using VBScript to manipulate the objects
on the form. The form has voting buttons added to it automatically but what I
am having difficulty with is dynamically setting the 'Have replies sent to
option'. I would like responses sent to the originator and also to another
fixed address. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Thanks
  #2  
Old April 24th 06, 09:57 PM posted to microsoft.public.outlook.program_forms
Hollis Paul [MVP - Outlook]
external usenet poster
 
Posts: 138
Default Voting Button

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Go to http://www.outlookcode.com/ and do a search on recipients. That
will give you a list of relevant entries for adding a recipient, and
then a list of relevant code samples.

--
Hollis Paul
Mukilteo, WA USA


  #3  
Old April 25th 06, 03:06 PM posted to microsoft.public.outlook.program_forms
DavidW
external usenet poster
 
Posts: 20
Default Voting Button

Hi Paul,

I searched the site that you recommended but could not find anything that
referred directly to the option I am trying to set.

Within 'Message Options' there is a 'Have replies sent to:' checkbox, what I
want to do is to programatically check this option and to populate its field
with the two addresses.

Apologies if I have missed something obvious.


Regards

"Hollis Paul [MVP - Outlook]" wrote:

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Go to http://www.outlookcode.com/ and do a search on recipients. That
will give you a list of relevant entries for adding a recipient, and
then a list of relevant code samples.

--
Hollis Paul
Mukilteo, WA USA



  #4  
Old April 25th 06, 08:07 PM posted to microsoft.public.outlook.program_forms
Hollis Paul [MVP - Outlook]
external usenet poster
 
Posts: 138
Default Voting Button

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
I searched the site that you recommended but could not find anything that
referred directly to the option I am trying to set.

Within 'Message Options' there is a 'Have replies sent to:' checkbox, what I
want to do is to programatically check this option and to populate its field
with the two addresses.

I am not sure that you really want to worry about the have replies sent to
field. If you want a message to go to two destinations, you add two recipient
objects, with the email and other parameters defined within the recipient
object, to the recipients collection. Then send the message object.

Now, is your code intervening in the message after the vote has been cast?
Then just add the recipients and let it send. If you are intervening when the
original message is being sent, then add the two email addresses as text,
separated by commas, to the replies sent to field. But, doing that relies upon
the functions included in the coding for the voting action. You should look at
that.

As I recall, there is a type field in the recipient object. Check to see if a
reply-to type is defined. If it is, then just adding two objects of reply-to
type is probably the easiest way to go.

There are a lot of possibilities, depending on where in the message generation
cycle you are intervening, so perhaps you should specify that and see if it
simplifies things.

--
Hollis Paul
Mukilteo, WA USA


  #5  
Old April 26th 06, 12:02 PM posted to microsoft.public.outlook.program_forms
DavidW
external usenet poster
 
Posts: 20
Default Voting Button

Hi Paul,

Sorry but I'm still confused. Here is the code I currently have in my form:

Public strFile

Function Item_Send()

Dim strVersion

Set cmbType = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("cmbType")
Set txtVersion = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("txtVersion")
strVersion = txtVersion.Value
[Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion

End Function

Sub cmdBrowseFile_Click()

Dim strFilePath
Dim fso, f
Dim strOrigBody

Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "All Files|*.xls;*.doc"
objDialog.InitialDir = "Y:\Comshare\Procedures and Guides\Review\"
intResult = objDialog.ShowOpen

If intResult 0 Then
strFilePath = "file://" & objDialog.FileName & ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(objDialog.FileName)
strFile = f.Name
strOrigBody = [Body]
[Body] = strFilePath & vbNewLine & _
vbNewLine & strOrigBody
End If

End Sub

I do not have any 'Have replies sent to' controls on the form. I did add one
and typed in an e-mail address but how would I be able to specify the
sender's e-mail address given that I don't know who the particular user is. I
looked at SenderEMailAddress but couldn't work out how to add this value to
the control.

Thanks for your patience!

Regards


"Hollis Paul [MVP - Outlook]" wrote:

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
I searched the site that you recommended but could not find anything that
referred directly to the option I am trying to set.

Within 'Message Options' there is a 'Have replies sent to:' checkbox, what I
want to do is to programatically check this option and to populate its field
with the two addresses.

I am not sure that you really want to worry about the have replies sent to
field. If you want a message to go to two destinations, you add two recipient
objects, with the email and other parameters defined within the recipient
object, to the recipients collection. Then send the message object.

Now, is your code intervening in the message after the vote has been cast?
Then just add the recipients and let it send. If you are intervening when the
original message is being sent, then add the two email addresses as text,
separated by commas, to the replies sent to field. But, doing that relies upon
the functions included in the coding for the voting action. You should look at
that.

As I recall, there is a type field in the recipient object. Check to see if a
reply-to type is defined. If it is, then just adding two objects of reply-to
type is probably the easiest way to go.

There are a lot of possibilities, depending on where in the message generation
cycle you are intervening, so perhaps you should specify that and see if it
simplifies things.

--
Hollis Paul
Mukilteo, WA USA



  #6  
Old April 26th 06, 08:17 PM posted to microsoft.public.outlook.program_forms
Hollis Paul [MVP - Outlook]
external usenet poster
 
Posts: 138
Default Voting Button

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
I do not have any 'Have replies sent to' controls on the form. I did add one
and typed in an e-mail address but how would I be able to specify the
sender's e-mail address given that I don't know who the particular user is.

If you look at the fields in the recipient object, using the Object Explorer
(?) In the script editor, you will find that each recipient object has a type
field. Here is how it is defined:

MailItem recipient: one of the following OlMailRecipientType constants: olBCC,
olCC, olOriginator, or olTo.

So, all you need to do is loop through the recipient objects until you find the
one whose Type field is set to olOriginator. Then pick off the address field
and add it to your string. Remember: VBScript still does not automatically
assign values to constant, so you need to look in the olMailRecipientType to
get the value for olOriginator.

--
Hollis Paul
Mukilteo, WA USA


  #7  
Old April 26th 06, 08:17 PM posted to microsoft.public.outlook.program_forms
Hollis Paul [MVP - Outlook]
external usenet poster
 
Posts: 138
Default Voting Button

In article ,
=?Utf-8?B?RGF2aWRX?= wrote:
Function Item_Send()

Dim strVersion

Set cmbType = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("cmbType")
Set txtVersion = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("txtVersion")
strVersion = txtVersion.Value
[Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion

End Function

OK, it would appear that you are expecting your code to run after the receiver
has voted and is sending the reply back. In this case you want to add the
recipient object of type olOriginator back as a new recipient object and change
the type to olTo (see my other message for details). Then add a second
recipient object of type olTo with the fixed address that you want to use. Then
do a resolve as shown in this reply by Ken Slovak, except change the resolve to
ResolveAll.

***************************************
From: "Ken Slovak - [MVP - Outlook]"
Subject: Item.Recipients.Add Not Working for me
Date: Wed, 26 Apr 2006 09:54:12 -0400
Newsgroups: microsoft.public.outlook.program_forms


Does it work better if you instantiate a Recipient object and then resolve
it?

Set oRecip = ")
oRecip.Resolve

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
****************************************

Tip to the wise. The code line

Set oRecip = ")

creates a default recipient object. You want to use an explicit process:

dim omyRecipient
dim olTo = 0 '(or whatever it is)
set myoRecipient = Item.Recipients.Add
omyRecipient.Address = "
omyRecipient.Type = olTo

Another word to the wise. If you are going to be doing a significant amount of
Outlook forms design and programming, go to www.dimastr.com and buy a copy of
OutlookSpy and Outlook Redemption. It will save you a huge amount of trouble in
the future.



--
Hollis Paul
Mukilteo, WA USA


  #8  
Old May 3rd 06, 03:14 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Voting Button

You'd need to work with the ReplyRecipients collection, which works just like the main Recipients collection, e.g. to add two recipients:

Item.ReplyRecipients.Add ")
strUserAddress = Application.Session.CurrentUser.Address
If strUserAddress "" Then
Item.ReplyRecipients.Add strUserAddress
End If

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

"DavidW" wrote in message ...
I have created a custom form and am using VBScript to manipulate the objects
on the form. The form has voting buttons added to it automatically but what I
am having difficulty with is dynamically setting the 'Have replies sent to
option'. I would like responses sent to the originator and also to another
fixed address. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Thanks

  #9  
Old May 12th 06, 03:09 PM posted to microsoft.public.outlook.program_forms
DavidW
external usenet poster
 
Posts: 20
Default Voting Button

Hi Sue,

Here is the amended code in my form:

------------------------------------------------------------------------------
Public strFile

Function Item_Send()

Dim strVersion
Dim strUserName

Set cmbType = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("cmbType")
Set txtVersion = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("txtVersion")
strVersion = txtVersion.Value
[Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion

Select Case cmbType.Text
Case "Change Request"
Item.VotingOptions = "Reject; Implement Immediately; Schedule
Implementation"
Case else
Item.VotingOptions = "Accept; Reject"
End Select

strUserName = Application.Session.CurrentUser.Name

Item.ReplyRecipients.Add "DMS"
Item.ReplyRecipients.Add strUserName

End Function

Sub cmdBrowseFile_Click()

Dim strFilePath
Dim fso, f
Dim strOrigBody

Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "All Files|*.xls;*.doc"
objDialog.InitialDir = "Y:\Comshare\Procedures and Guides\Review\"
intResult = objDialog.ShowOpen

If intResult 0 Then
strFilePath = "file://" & objDialog.FileName & ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(objDialog.FileName)
strFile = f.Name
strOrigBody = [Body]
[Body] = strFilePath & vbNewLine & _
vbNewLine & strOrigBody
End If

End Sub

--------------------------------------------------------------------------------------

However, whenever the user clicks on any of the voting buttons the reply is
sent to the originator only and does not include the DMS user.

Thanks
David




"Sue Mosher [MVP-Outlook]" wrote:

You'd need to work with the ReplyRecipients collection, which works just like the main Recipients collection, e.g. to add two recipients:

Item.ReplyRecipients.Add ")
strUserAddress = Application.Session.CurrentUser.Address
If strUserAddress "" Then
Item.ReplyRecipients.Add strUserAddress
End If

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

"DavidW" wrote in message ...
I have created a custom form and am using VBScript to manipulate the objects
on the form. The form has voting buttons added to it automatically but what I
am having difficulty with is dynamically setting the 'Have replies sent to
option'. I would like responses sent to the originator and also to another
fixed address. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Thanks


  #10  
Old May 12th 06, 03:30 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Voting Button

Is this a form published to the Organizational Forms library?

Just curious: If the recipient does a regular reply to the message, rather than choosing a voting button, does it go to both recipients?

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

"DavidW" wrote in message ...
Hi Sue,

Here is the amended code in my form:

------------------------------------------------------------------------------
Public strFile

Function Item_Send()

Dim strVersion
Dim strUserName

Set cmbType = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("cmbType")
Set txtVersion = _
Item.GetInspector.ModifiedFormPages.Item("Message" ).Controls("txtVersion")
strVersion = txtVersion.Value
[Subject] = "Document " & cmbType.Value & " - " & strFile & " v" & strVersion

Select Case cmbType.Text
Case "Change Request"
Item.VotingOptions = "Reject; Implement Immediately; Schedule
Implementation"
Case else
Item.VotingOptions = "Accept; Reject"
End Select

strUserName = Application.Session.CurrentUser.Name

Item.ReplyRecipients.Add "DMS"
Item.ReplyRecipients.Add strUserName

End Function

Sub cmdBrowseFile_Click()

Dim strFilePath
Dim fso, f
Dim strOrigBody

Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "All Files|*.xls;*.doc"
objDialog.InitialDir = "Y:\Comshare\Procedures and Guides\Review\"
intResult = objDialog.ShowOpen

If intResult 0 Then
strFilePath = "file://" & objDialog.FileName & ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(objDialog.FileName)
strFile = f.Name
strOrigBody = [Body]
[Body] = strFilePath & vbNewLine & _
vbNewLine & strOrigBody
End If

End Sub

--------------------------------------------------------------------------------------

However, whenever the user clicks on any of the voting buttons the reply is
sent to the originator only and does not include the DMS user.

Thanks
David




"Sue Mosher [MVP-Outlook]" wrote:

You'd need to work with the ReplyRecipients collection, which works just like the main Recipients collection, e.g. to add two recipients:

Item.ReplyRecipients.Add ")
strUserAddress = Application.Session.CurrentUser.Address
If strUserAddress "" Then
Item.ReplyRecipients.Add strUserAddress
End If

"DavidW" wrote in message ...
I have created a custom form and am using VBScript to manipulate the objects
on the form. The form has voting buttons added to it automatically but what I
am having difficulty with is dynamically setting the 'Have replies sent to
option'. I would like responses sent to the originator and also to another
fixed address. Can someone please provide me with some sample VBScript code
that I could use to accomplish this task?

Thanks


 




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
Voting Buttons & Excel Junoon Outlook and VBA 10 April 18th 06 06:09 AM
Voting button stanhope4 Outlook and VBA 6 April 13th 06 09:11 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 08:24 PM.


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.