TO field

Status
Not open for further replies.
W

Wanda

I have created a custom form. I have a drop down menu to be able to select

a province. Is there a way when a certain province is selected that it put

a certain address in the TO field on the form? When I put the code in and

we try to send the form, it comes saying "There must be a least one name or

distribution list in the To, CC or BCC box". If the form has something in

one of the fields (TO, CC or BCC) and then with the code, it will add the

code I put in ... but originally, I don't want anything in the name fields.

Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.

Thank you.

Wanda
 
See http://outlookcode.com/article.aspx?ID=38 for information on the events

you can use to change the To field when the user selects from your combo

box. The details depend on whether the combo box is bound to an Outlook

property and, of so, which one.

Sue Mosher

"Wanda" <Wanda> wrote in message

news:21B05773-C8A5-4571-8F1B-60DF82923901@microsoft.com...
> I have created a custom form. I have a drop down menu to be able to
> select
> a province. Is there a way when a certain province is selected that it
> put
> a certain address in the TO field on the form? When I put the code in
> and
> we try to send the form, it comes saying "There must be a least one name
> or
> distribution list in the To, CC or BCC box". If the form has something
> in
> one of the fields (TO, CC or BCC) and then with the code, it will add the
> code I put in ... but originally, I don't want anything in the name
> fields.
> Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
> Thank you.
> Wanda
 
Hi Sue:

This works good to bring up a message. My code was:

***********

Sub cmdTest_Click()

Set objTab1 = Item.GetInspector.ModifiedFormPages("General")

Set objControls = objTab1.Controls("cmbProv")

IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN

msgBox "Hi"

End If

End Sub

***************

When I change msgBox "hi" to:

> .TO = "moyerw"

a message comes up saying "Invalid or unqualified reference". Can I put

the address in the TO (recipient) field this way?

Thank you.

Wanda

"Sue Mosher [MVP]" wrote:


> See http://outlookcode.com/article.aspx?ID=38 for information on the events
> you can use to change the To field when the user selects from your combo
> box. The details depend on whether the combo box is bound to an Outlook
> property and, of so, which one.
> > Sue Mosher
> > >

> "Wanda" <Wanda> wrote in message
> news:21B05773-C8A5-4571-8F1B-60DF82923901@microsoft.com...
> >I have created a custom form. I have a drop down menu to be able to
> >select
> > a province. Is there a way when a certain province is selected that it
> > put
> > a certain address in the TO field on the form? When I put the code in
> > and
> > we try to send the form, it comes saying "There must be a least one name
> > or
> > distribution list in the To, CC or BCC box". If the form has something
> > in
> > one of the fields (TO, CC or BCC) and then with the code, it will add the
> > code I put in ... but originally, I don't want anything in the name
> > fields.
> > Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
> > Thank you.
> > Wanda


>
 
The error message means what it says. You have a ".To" expression outside a

With ... End With block. Therefore, Outlook has no idea what object's To

property your code refers to. Use either:

With Item

> To = "moyerw"

End With

or

Item.To = "moyerw"

Some suggestions:

-- If a control is bound to an Outlook field/property, refer to the

field value not the control value in your code; see

http://www.outlookcode.com/article.aspx?ID=38.

-- Once you have the value, use a Select Case ... End Select block to

evaluate it and perform other actions, not a series of If ... End If

statements.

-- When setting the value of To, use the full email address or an alias

that is uniquely resolvable to an address.

Sue Mosher

"Wanda" <Wanda> wrote in message

news:99F1249D-A02D-4378-9F75-DC5869D025D2@microsoft.com...
> Hi Sue:
> This works good to bring up a message. My code was:
> ***********
> Sub cmdTest_Click()
> Set objTab1 = Item.GetInspector.ModifiedFormPages("General")
> Set objControls = objTab1.Controls("cmbProv")
> IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN
> msgBox "Hi"
> End If
> End Sub
> ***************
> When I change msgBox "hi" to:
> .TO = "moyerw"

> a message comes up saying "Invalid or unqualified reference". Can I put
> the address in the TO (recipient) field this way?
> Thank you.
> Wanda

> "Sue Mosher [MVP]" wrote:
>
> > See http://outlookcode.com/article.aspx?ID=38 for information on the
> > events
> > you can use to change the To field when the user selects from your combo
> > box. The details depend on whether the combo box is bound to an Outlook
> > property and, of so, which one.
>

>> "Wanda" <Wanda> wrote in message
> > news:21B05773-C8A5-4571-8F1B-60DF82923901@microsoft.com...
> > >I have created a custom form. I have a drop down menu to be able to
> > >select
> > > a province. Is there a way when a certain province is selected that
> > > it
> > > put
> > > a certain address in the TO field on the form? When I put the code in
> > > and
> > > we try to send the form, it comes saying "There must be a least one
> > > name
> > > or
> > > distribution list in the To, CC or BCC box". If the form has
> > > something
> > > in
> > > one of the fields (TO, CC or BCC) and then with the code, it will add
> > > the
> > > code I put in ... but originally, I don't want anything in the name
> > > fields.
> > > Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
> > > Thank you.
> > > Wanda
 
Thank you very much Sue! It works like a charm. This helped a great deal.

You helped out in other parts of the custom form also, which was an asset.

Again, thank you very much.

Wanda

"Sue Mosher [MVP]" wrote:


> The error message means what it says. You have a ".To" expression outside a
> With ... End With block. Therefore, Outlook has no idea what object's To
> property your code refers to. Use either:

> With Item
> .To = "moyerw"
> End With

> or

> Item.To = "moyerw"

> Some suggestions:

> -- If a control is bound to an Outlook field/property, refer to the
> field value not the control value in your code; see
> http://www.outlookcode.com/article.aspx?ID=38.

> -- Once you have the value, use a Select Case ... End Select block to
> evaluate it and perform other actions, not a series of If ... End If
> statements.

> -- When setting the value of To, use the full email address or an alias
> that is uniquely resolvable to an address.

> > Sue Mosher
> > >

> "Wanda" <Wanda> wrote in message
> news:99F1249D-A02D-4378-9F75-DC5869D025D2@microsoft.com...
> > Hi Sue:
> > This works good to bring up a message. My code was:
> > ***********
> > Sub cmdTest_Click()
> > Set objTab1 = Item.GetInspector.ModifiedFormPages("General")
> > Set objControls = objTab1.Controls("cmbProv")
> > IF objTab1.Controls("cmbProv")= "Saskatchewan" THEN
> > msgBox "Hi"
> > End If
> > End Sub
> > ***************
> > When I change msgBox "hi" to:
> > .TO = "moyerw"
> > a message comes up saying "Invalid or unqualified reference". Can I put
> > the address in the TO (recipient) field this way?
> > Thank you.
> > Wanda
> > "Sue Mosher [MVP]" wrote:
> >
> >> See http://outlookcode.com/article.aspx?ID=38 for information on the
> >> events
> >> you can use to change the To field when the user selects from your combo
> >> box. The details depend on whether the combo box is bound to an Outlook
> >> property and, of so, which one.
> >
> >> "Wanda" <Wanda> wrote in message
> >> news:21B05773-C8A5-4571-8F1B-60DF82923901@microsoft.com...
> >> >I have created a custom form. I have a drop down menu to be able to
> >> >select
> >> > a province. Is there a way when a certain province is selected that
> >> > it
> >> > put
> >> > a certain address in the TO field on the form? When I put the code in
> >> > and
> >> > we try to send the form, it comes saying "There must be a least one
> >> > name
> >> > or
> >> > distribution list in the To, CC or BCC box". If the form has
> >> > something
> >> > in
> >> > one of the fields (TO, CC or BCC) and then with the code, it will add
> >> > the
> >> > code I put in ... but originally, I don't want anything in the name
> >> > fields.
> >> > Is there a way around this? We are use XP-SP3 and Outlook 2003, sp3.
> >> > Thank you.
> >> > Wanda


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Outlook 365 Delete entries in title field, address book Using Outlook 0
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Outlook VBA forward the selected email to the original sender’s email ID (including the email used in TO, CC Field) from the email chain Outlook VBA and Custom Forms 2
D Outlook 365 Custom forms field limit? Outlook VBA and Custom Forms 4
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
S Combination Field (Date Format) Outlook VBA and Custom Forms 0
Witzker Add a text line at the end of the note field in all selected Contacts Outlook VBA and Custom Forms 7
M copy field value to custom field Outlook VBA and Custom Forms 0
J images on note field display fraction of size Using Outlook 5
C Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 4
J How to create a drop down user defined field that will appear on an inbox view Outlook VBA and Custom Forms 8
C Move or copy from field to field Outlook VBA and Custom Forms 0
O Filter-Query Builder-Description - what field name to use? Using Outlook 4
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
N Contact Form Notes Field Touch vs Mouse Using Outlook 0
S CONTACT FIELD PRINT ORDER Outlook VBA and Custom Forms 1
V Checking for empty field Outlook VBA and Custom Forms 2
V Update new custom field Outlook VBA and Custom Forms 5
HappyDaddy007 "Size" on field chooser/column displaying incorrect value Using Outlook 3
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4
H Information from user defined field into Excel Outlook VBA and Custom Forms 7
I Outlook 2003 shows html code when To: field is empty Using Outlook 7
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
D Outlook Contacts Notes Field Photos to Smartphone Using Outlook 0
S Custom Field Cannot Be Displayed In Views Outlook VBA and Custom Forms 2
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
S Create a clickable custom column field Outlook VBA and Custom Forms 0
B User defined field for messages with 'me' in the [To], [Cc] line Using Outlook 0
V Limiting text length in free text field Outlook VBA and Custom Forms 2
C Outlook 2016 Conditional Format for User Defined Field Using Outlook 1
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
A new labeled phone field Using Outlook 4
V Making a Date field mandatory in outlook form Outlook VBA and Custom Forms 2
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
BretAB Is it possible to add a lookup field to a Message form? Outlook VBA and Custom Forms 4
N Exporting IM Address field Using Outlook 2
M Using field names to capture a data element Using Outlook 0
J How to restore field no longer visible in field chooser? Using Outlook 1
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R What's supposed to appear when just clicking into the search field? Using Outlook 7
A Missing context menu on Location field Using Outlook 2
G Entered data in custom field goes in card and does not stay in list view Outlook VBA and Custom Forms 1
C Changed By field not displaying individual user's name in O365 Shared Mailbox Using Outlook 9
M Making Subject field writable (disable Read Only) Outlook VBA and Custom Forms 2
C Import Outlook 2016 contacts into to: field Using Outlook 1
T Source of Outlook 2016 Address field dropdown "Other Suggestions" Using Outlook 3
S BCM Compulsory field, New opportunity Outlook VBA and Custom Forms 0
M Sudden change in From field - now very short Using Outlook 4

Similar threads

Back
Top