Form - Specific "To" Recipient value

Status
Not open for further replies.
D

daniel_l_v

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

"daniel_l_v" <daniellv> 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?
>
 
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.
 
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

"daniel_l_v" <daniellv> 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.
 
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.
 
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

"daniel_l_v" <daniellv> 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.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M form or template associated to a specific email recipient Outlook VBA and Custom Forms 3
D Re: Opening a specific Custom form with a macro Outlook VBA and Custom Forms 3
G Apply Custom Contacts form to all existing Contacts Outlook VBA and Custom Forms 1
G Add Map It button to Custom Contacts Form in Outlook Outlook VBA and Custom Forms 1
G Outlook 2021 Add Picture to Custom Contact Form Outlook VBA and Custom Forms 2
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
AndyZ Contact Custom Form Tiny Text Outlook VBA and Custom Forms 3
A How to reduce size of custom contact form? Outlook VBA and Custom Forms 3
L Applying new form to existing contacts -- MessageClass Outlook VBA and Custom Forms 3
Geldner Problem submitting SPAM using Outlook VBA Form Outlook VBA and Custom Forms 2
Witzker How to get the button Karte ( map) in custom contact form Outlook VBA and Custom Forms 2
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
C Populate form data into message body Outlook VBA and Custom Forms 1
Witzker Outlook 2019 How to get a Photo in a User Defined Contact form Outlook VBA and Custom Forms 2
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
Witzker Place cursor at opening, a user defined OL contact form Outlook VBA and Custom Forms 3
T Customized form: The Forward option shows write layout Outlook VBA and Custom Forms 0
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
V Latest Changes to form not appearing for some users Outlook VBA and Custom Forms 3
J Does the .fdm contain my custom form? How to make ol use it? - ol2007 Outlook VBA and Custom Forms 4
J ol2021 custom form not displaying pics Outlook VBA and Custom Forms 37
bdsermons Outlook 365 command button in outlook form Outlook VBA and Custom Forms 5
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 4
N Contact Form Notes Field Touch vs Mouse Using Outlook 0
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
C Create Meeting With Custom Form Outlook VBA and Custom Forms 2
W Designer Form 2013 and Script ? how ? Outlook VBA and Custom Forms 1
J Read Outlook Form fields Outlook VBA and Custom Forms 3
V Compound IF, OR, AND in Outlook form Outlook VBA and Custom Forms 4
J custom form not displaying pictures Outlook VBA and Custom Forms 7
I Button PDF in Outlook Contact custom form Outlook VBA and Custom Forms 1
K Font Sizing in Custom Form Regions for Contacts Outlook VBA and Custom Forms 1
V Validating Outlook form with "OR" and "AND" Outlook VBA and Custom Forms 1
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
A How to stop user form from disapearing once mail window is closed? Outlook VBA and Custom Forms 0
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
V Form data not sending for some users Outlook VBA and Custom Forms 2
H Custom Outlook Contact Form VBA Outlook VBA and Custom Forms 1
Witzker HowTo Change message Class of contact form Outlook VBA and Custom Forms 0
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
Witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
D Emailed form is blank Outlook VBA and Custom Forms 0
F Validation on custom task form after task acceptance Outlook VBA and Custom Forms 1
C Add Form to Appointments Received, Automatically Outlook VBA and Custom Forms 6
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
A Form Position with Dual Monitors Outlook VBA and Custom Forms 2
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
G Other users can't see P.2 with custom fields in Form Outlook VBA and Custom Forms 0

Similar threads

Back
Top