Outlook Custom Form...what am I doing wrong?

D

Doreen

I've created a custom Contact form, I have data that needs to go in two
custom fields. I took the macro from here:
http://www.outlookcode.com/d/code/convertfields.htm and it converts the
imported contacts to the RequiredForm that I want to use, but I can't get it
to put my data into the custom fields.

Any ideas what I'm doing wrong? My custom fields are FollowUpField and
TypeContactField. When I import the data, I map them to user1 and user2.

This is the part of the macro that I changed to fit my data:

objItem.MessageClass = "IPM.Contact.RequiredForm"
' copy data to your custom fields
objItem.UserProperties("FollowUpField") = objItem.User1
objItem.UserProperties("TypeContactField") = objItem.User2
objItem.UserProperties("Custom3") = objItem.User3
objItem.UserProperties("Custom4") = objItem.User4
objItem.User1 = ""
objItem.User2 = ""
objItem.User3 = ""
objItem.User4 = ""
objItem.Save

Any help would be greatly appreciated. Thanks!

Doreen
 
S

Sue Mosher [MVP-Outlook]

What are the symptoms? Error messages? Do you see the fields on the All
FIelds page under User-defined Fields in This Item?
 
D

Doreen

No error messages...I see the field names on the All Fields page after I run
the macro, but there is no information in the fields.
 
S

Sue Mosher [MVP-Outlook]

But under *which* list -- User-defined Fields in This Item or User-defined
Fields in Folder?

Have you tested to see whether User1 and User2 actually contain data?

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

Doreen

Sue Mosher said:
But under *which* list -- User-defined Fields in This Item or User-defined
Fields in Folder?

Have you tested to see whether User1 and User2 actually contain data?

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

Doreen

Sorry for the blank send.

There are no fields in the Folder, just my two custom fields under This
Item.

When I import the data, I see entries in the User 1 and User 2 fields, but
after I run the macro the data is nowhere to be found.
 
S

Sue Mosher [MVP-Outlook]

Can you show more of the code you're actually using? Nothing jumps out as a
likely cause of your problems.

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

Doreen

Sue this is the code I'm using:

Sub ConvertFields()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objItems As Items
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If Not objFolder Is Nothing Then
Set objItems = objFolder.Items
For Each objItem In objItems
' make sure you have a Contact item
If objItem.Class = olContact Then
' convert to your published custom form
objItem.MessageClass = "IPM.Contact.RequiredForm"
' copy data to your custom fields
objItem.UserProperties("FollowUpField") = objItem.User1
objItem.UserProperties("TypeContactField") = objItem.User2
objItem.UserProperties("Custom3") = objItem.User3
objItem.UserProperties("Custom4") = objItem.User4
objItem.User1 = ""
objItem.User2 = ""
objItem.User3 = ""
objItem.User4 = ""
objItem.Save
End If
Next
End If
 
S

Sue Mosher [MVP-Outlook]

On your contact form in design mode, do the custom fields show up under
User-defined Fields in Folder or User-Defined Fields in THis Item?

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