Populating a text box from another?

Z

Zer0

Hi People,
Can one 1 tell me (provide any code) for the following problem.
Ok, I have an email form in Outlook and I would like to create a button
that, when clicked, will populate (or copy) the contents from a textbox to
the "To.." field.

I hope this is possible :)

TIA,
Zer0
 
S

Sue Mosher [MVP-Outlook]

Sub CommandButton1_Click()
Set page = Item.GetInspector.ModifiedFormPages("my page")
Set textbox1 = page.Controls("TextBox1")
Item.To = textbox1.Value
End Sub

See http://www.outlookcode.com/d/propsyntax.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
H

Hollis Paul [MVP - Outlook]

Can one 1 tell me (provide any code) for the following problem.
Ok, I have an email form in Outlook and I would like to create a button
that, when clicked, will populate (or copy) the contents from a textbox to
the "To.." field.
That isn't how an email is addressed by code. Instead, you want to add a
recipient object of type To: to the recipients collection object, then send
the item. Go to Outlookcode.com and search on recipient object and look at
the code examples there. Alternately, get the definitions of these objects
from the Outlook object model and the code page help function using the
Object browser (F2 in the Code page editor).
 
H

Hollis Paul [MVP - Outlook]

Sue Mosher said:
Set textbox1 = page.Controls("TextBox1")
Item.To = textbox1.Value
But Sue, he is really trying to set the To: field text box--i.e. Set up
who the form will be sent to.
 
Z

Zer0

Thanks for all the help people.
Sue's way did work, however, I have a new problem now!
The button I have talked about on here will not work on the form (.oft)
unless it is published. Due to the setup of our systems and users, this is
not possible. Is there any way I can make this button work without
publishing it first? (i.e. just opening up the .oft from the desktop)

Thanks people, amazing service you provide here (for free too!!)
Zer0
 
H

Hollis Paul [MVP - Outlook]

Is there any way I can make this button work without
publishing it first? (i.e. just opening up the .oft from the desktop)
In a word, no. Give thanks to the great deity at microsoft who has
decreed that it is unsafe computing to be able to run code behind a
just opened .oft. Your job now, should you choose to accept it, is to
educate your managers in the realities of current best practice in
Exchange server usage. Buwah-ha-ha-ha! This tape will self-destruct
in 15 seconds.
 

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