Command Button in Form in Outlook2003

G

Guest

I created a Form in Outlook 2003 and put in a Command Button for the user to
click on to submit the form. I set up the Command Button for an Email
Address.
I want the User to just click and form it sent to the mail recipient.
However, when I test it, it goes to the Global Address Book and in the TO
field it has the recipient so I click ok and then I have to go up to Send in
the Tool Bar. I do not want the user to have to do this. I just want the
user to click on the button and it automatically sends the form to the
recipient.
 
S

Sue Mosher [MVP-Outlook]

This is not a valid code statement:

[To] "mf security access"

If you want to replace the To recipients on the message with the recipient above, you need to use the proper syntax for setting an Outlook item property (see http://www.outlookcode.com/d/propsyntax.htm):

Item.To = "mf security access"

Also note that if "mf security access" does not resolve to a unique address, Outlook will not be able to send the message.

Furthermore, Item_Send() is an event handler function that fires when the user clicks Send. It does not run when a user clicks a command button on the form, unless that button itself invokes the Send method:

Sub CommandButton1_Click()
Item.Send
End Sub

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



hhitsec said:
Function Item_Send() [To] "mf security access" End Function
 
G

Guest

Thank you! One question, when the button is now clicked, it pulls up the
Global Address Book to resolve the address. The email account: mf security
access is active and does exist. The Display name is: MF Security Access
the email address is: (e-mail address removed)

What part am I missing.

Sue Mosher said:
This is not a valid code statement:

[To] "mf security access"

If you want to replace the To recipients on the message with the recipient above, you need to use the proper syntax for setting an Outlook item property (see http://www.outlookcode.com/d/propsyntax.htm):

Item.To = "mf security access"

Also note that if "mf security access" does not resolve to a unique address, Outlook will not be able to send the message.

Furthermore, Item_Send() is an event handler function that fires when the user clicks Send. It does not run when a user clicks a command button on the form, unless that button itself invokes the Send method:

Sub CommandButton1_Click()
Item.Send
End Sub

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



hhitsec said:
Function Item_Send() [To] "mf security access" End Function
I created a Form in Outlook 2003 and put in a Command Button for the user to
click on to submit the form. I set up the Command Button for an Email
Address.
I want the User to just click and form it sent to the mail recipient.
However, when I test it, it goes to the Global Address Book and in the TO
field it has the recipient so I click ok and then I have to go up to Send in
the Tool Bar. I do not want the user to have to do this. I just want the
user to click on the button and it automatically sends the form to the
recipient.
 
G

Guest

Here is my code that I am using.

Sub cmdSubmitEDWandStudentTermsAccessForm_Click()
Item.To = "(e-mail address removed)12.fl.us"
Item.Send
End Sub


hhitsec said:
Thank you! One question, when the button is now clicked, it pulls up the
Global Address Book to resolve the address. The email account: mf security
access is active and does exist. The Display name is: MF Security Access
the email address is: (e-mail address removed)

What part am I missing.

Sue Mosher said:
This is not a valid code statement:

[To] "mf security access"

If you want to replace the To recipients on the message with the recipient above, you need to use the proper syntax for setting an Outlook item property (see http://www.outlookcode.com/d/propsyntax.htm):

Item.To = "mf security access"

Also note that if "mf security access" does not resolve to a unique address, Outlook will not be able to send the message.

Furthermore, Item_Send() is an event handler function that fires when the user clicks Send. It does not run when a user clicks a command button on the form, unless that button itself invokes the Send method:

Sub CommandButton1_Click()
Item.Send
End Sub

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



hhitsec said:
Function Item_Send() [To] "mf security access" End Function

I created a Form in Outlook 2003 and put in a Command Button for the user to
click on to submit the form. I set up the Command Button for an Email
Address.
I want the User to just click and form it sent to the mail recipient.
However, when I test it, it goes to the Global Address Book and in the TO
field it has the recipient so I click ok and then I have to go up to Send in
the Tool Bar. I do not want the user to have to do this. I just want the
user to click on the button and it automatically sends the form to the
recipient.
 
S

Sue Mosher [MVP-Outlook]

Outlook will attempt to resolve names against the address books set for name resolution in the current mail profile. If you know already know the SMTP address, use that to set the To property and there will be no need to resolve against any address book. In other words, the code you have below should work fine.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



hhitsec said:
Here is my code that I am using.

Sub cmdSubmitEDWandStudentTermsAccessForm_Click()
Item.To = "(e-mail address removed)12.fl.us"
Item.Send
End Sub


hhitsec said:
Thank you! One question, when the button is now clicked, it pulls up the
Global Address Book to resolve the address. The email account: mf security
access is active and does exist. The Display name is: MF Security Access
the email address is: (e-mail address removed)

What part am I missing.

Sue Mosher said:
This is not a valid code statement:

[To] "mf security access"

If you want to replace the To recipients on the message with the recipient above, you need to use the proper syntax for setting an Outlook item property (see http://www.outlookcode.com/d/propsyntax.htm):

Item.To = "mf security access"

Also note that if "mf security access" does not resolve to a unique address, Outlook will not be able to send the message.

Furthermore, Item_Send() is an event handler function that fires when the user clicks Send. It does not run when a user clicks a command button on the form, unless that button itself invokes the Send method:

Sub CommandButton1_Click()
Item.Send
End Sub

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Function Item_Send() [To] "mf security access" End Function

I created a Form in Outlook 2003 and put in a Command Button for the user to
click on to submit the form. I set up the Command Button for an Email
Address.
I want the User to just click and form it sent to the mail recipient.
However, when I test it, it goes to the Global Address Book and in the TO
field it has the recipient so I click ok and then I have to go up to Send in
the Tool Bar. I do not want the user to have to do this. I just want the
user to click on the button and it automatically sends the form to the
recipient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top