custom form field to TO field in word.dot

J

Joel

Hello,

I am trying to get a field in my custom task form to merge into the "TO" and "SUBJECT" field in a word.dot file. You cannot put Form Fields into those text fields.

Does anybody know how to do this successfully or maybe somebody has an example script?

Thanks much,
Joel
 
S

Sue Mosher [MVP-Outlook]

Generally, you'd create form fields and set the value of the form field to
the desired Outlook property value. If that's not working, show a code
snippet.

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



Hello,

I am trying to get a field in my custom task form to merge into the "TO" and
"SUBJECT" field in a word.dot file. You cannot put Form Fields into those
text fields.

Does anybody know how to do this successfully or maybe somebody has an
example script?

Thanks much,
Joel
 
J

Joel

Sue,

I simply put the "To" field into my custom form. So in my script, I'm use
to mapping fields to Form Fields, but don't know how to do it for the "To"
field. Here's an example of what I tried and it didn't work. Can you
please help further?

colFields("To").Result = _
Item.UserProperties("To")

Thank you - Joel
 
S

Sue Mosher [MVP-Outlook]

UserProperties is for custom fields only. You use a different syntax for
built-in fields -- Item.To. See http:/www.outlookcode.com/d/propsyntax.htm
for more information on this.

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

Joel

I tried this but it didn't work. Is there any quick sample code. I didn't
see anything that help me in the link you sent. Sorry. Please help. :)

colFields("To").Result = _
Item.To

Thanks - Joel
 
S

Sue Mosher [MVP-Outlook]

The object browser is your friend: Press ALt+F11 to open the VBA environment
in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse
all Outlook objects and their properties, methods, and events.If you do
this, you'll see that the TaskItem object has no To property. (Sorry I
didn't notice earlier that you're working with a task not a message.) All
the recipient information is stored in the Recipients collection, which you
can Iterate with a For Each loop:

For Each objRecip in Item.Recipients
strNames = strNames & ", " & objRecip.Name
Next
strNames = Mid(strNames, 2)
colFields("To").Result = strNames

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

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