Help!

Form - Specific "To" Recipient value

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Forms RSS
Next:  Gmail to Outlook 2003  
Author Message
daniel_l_v
External


Since: Jun 28, 2009
Posts: 3



PostPosted: Sun Jun 28, 2009 4:28 pm    Post subject: Form - Specific "To" Recipient value
Archived from groups: microsoft>public>outlook>program_forms (more info?)

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?
Back to top
Sue Mosher [MVP]
External


Since: Mar 19, 2009
Posts: 41



PostPosted: Sun Jun 28, 2009 11:06 pm    Post subject: Re: Form - Specific "To" Recipient value [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 = "myaddress@mycompany.com"
Item.Recipients.ResolveAll
End If
End Function

Function Item_Send()
Item.To = "myaddress@mycompany.com"
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" <daniellv.RemoveThis@discussions.microsoft.com> wrote in message
news:96F6BE28-D254-4AD1-81C5-15166093AF1F@microsoft.com...
> 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?
>
Back to top
daniel_l_v
External


Since: Jun 28, 2009
Posts: 3



PostPosted: Sun Jun 28, 2009 11:06 pm    Post subject: Re: Form - Specific "To" Recipient value [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.
Back to top
Sue Mosher [MVP]
External


Since: Mar 19, 2009
Posts: 41



PostPosted: Mon Jun 29, 2009 8:58 am    Post subject: Re: Form - Specific "To" Recipient value [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <daniellv.RemoveThis@discussions.microsoft.com> wrote in message
news:037E7839-8090-4049-A885-84FBE42EE316@microsoft.com...
> 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.
Back to top
daniel_l_v
External


Since: Jun 28, 2009
Posts: 3



PostPosted: Mon Jun 29, 2009 4:43 pm    Post subject: Re: Form - Specific "To" Recipient value [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

-----------------------------------------------------------------------------
Less Spam Better enjoyable experience
Visit : news://spacesst.com
Back to top
Sue Mosher [MVP]
External


Since: Mar 19, 2009
Posts: 41



PostPosted: Tue Jun 30, 2009 1:04 am    Post subject: Re: Form - Specific "To" Recipient value [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" <daniellv.TakeThisOut@discussions.microsoft.com> wrote in message
news:935F5C0A-37CD-437C-87A0-70CF714D2666@microsoft.com...
> 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.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Program Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum