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

Form - Specific "To" Recipient value



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 29th 09, 12:28 AM posted to microsoft.public.outlook.program_forms
daniel_l_v
external usenet poster
 
Posts: 3
Default Form - Specific "To" Recipient value

Created a simple "Phone Message" style custom Outlook 2007 form.
Want to set the "To" field to a specific email address that customers cannot
change, have not been able to do this.

Can anyone advise whether the "To" field can be set programmatically prior
to the message being sent, so that it always gets sent to the same recipient?

Ads
  #2  
Old June 29th 09, 04:06 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Form - Specific "To" Recipient value

Sure, that's possible. Remove the address controls from the form and try
this code:

Function Item_Open()
If Item.Sent False Then
Item.To = "
Item.Recipients.ResolveAll
End If
End Function

Function Item_Send()
Item.To = "
End Function

The Item.To statement is in both events to make sure there's a recipient
already present when the user tries to send the item. This won't prevent a
user from bringing up the Address Book dialog and changing the recipients,
but the Item_Send code will override any changes they've made.

You are planning to publish this form to the Organizational Forms library or
to each user's Personal Forms library, correct?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"daniel_l_v" wrote in message
...
Created a simple "Phone Message" style custom Outlook 2007 form.
Want to set the "To" field to a specific email address that customers
cannot
change, have not been able to do this.

Can anyone advise whether the "To" field can be set programmatically prior
to the message being sent, so that it always gets sent to the same
recipient?



  #3  
Old June 29th 09, 04:41 AM posted to microsoft.public.outlook.program_forms
daniel_l_v
external usenet poster
 
Posts: 3
Default Form - Specific "To" Recipient value

Hi Sue,

Thanks for the code.

I've put the code you suggested in the script editor and saved my form.

However, whilst the code doesn't give any errors, it doesn't seem to
actually trigger. I've put in a couple of MsgBox statesments to check, but
neither seems to run.

Yes - The form will be published eventually to Organizational Forms.

Is there something I might me missing that could be stopping the code from
actually running? Do I need any header or tags in the script to ensure it is
in the correct format?

Just checking, I should be putting the code in the "View Code" Script
Editor, and NOT in a Visual Basic project.
  #4  
Old June 29th 09, 01:58 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Form - Specific "To" Recipient value

I don't know what you mean by "saved my form." Code runs only on published
forms. You'll need to publish it to get it to work.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


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

Thanks for the code.

I've put the code you suggested in the script editor and saved my form.

However, whilst the code doesn't give any errors, it doesn't seem to
actually trigger. I've put in a couple of MsgBox statesments to check,
but
neither seems to run.

Yes - The form will be published eventually to Organizational Forms.

Is there something I might me missing that could be stopping the code from
actually running? Do I need any header or tags in the script to ensure it
is
in the correct format?

Just checking, I should be putting the code in the "View Code" Script
Editor, and NOT in a Visual Basic project.



  #5  
Old June 30th 09, 12:43 AM posted to microsoft.public.outlook.program_forms
daniel_l_v
external usenet poster
 
Posts: 3
Default Form - Specific "To" Recipient value

Sue, by "save my form" I meant exactly that, you can save a form as an OFT
file whilst working on it.

I've published but still not working.

Is the "Item" an object representing the message itself? I can't find
"Item" in the VB Script Object Browser.
  #6  
Old June 30th 09, 06:04 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Form - Specific "To" Recipient value

As I said, only published forms run code. Forms saved as .oft files don't.

Item is an intrinsic object in custom form code representing the current
item, just as Application represents the running Outlook.Application object.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"daniel_l_v" wrote in message
...
Sue, by "save my form" I meant exactly that, you can save a form as an OFT
file whilst working on it.

I've published but still not working.

Is the "Item" an object representing the message itself? I can't find
"Item" in the VB Script Object Browser.



 




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
form or template associated to a specific email recipient [email protected] Outlook - Using Forms 3 April 21st 09 09:03 PM
How to Access the "To" Recipient field and update it in outlook form Venkat M Outlook - Using Forms 11 October 13th 08 08:01 PM
"Add Field" button under "Customized Form" stop working??? Troika Outlook - Using Forms 1 March 4th 08 01:17 AM
right click any doc & "Send To" a "Mail Recipient" won't get sent David Grana Outlook - Installation 1 February 27th 08 08:46 PM
Rule "with specific words.." and "reply with.." works inconsistent ppi Outlook - Installation 2 February 8th 08 06:01 PM


All times are GMT +1. The time now is 08:12 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.