Setting values to Custom Fields on Custom Forms 
Author Message
 Setting values to Custom Fields on Custom Forms

Please help (again)

I have a custome Contacts Form. In it I have placed a combo and tex box,
cmbType and txtDX. I have also set these up as Custom fields, Type and DX as
text fields. The code below works fine to open up my customised form. How do
I set the values for Type and DX though?

Dim NameSpace   As NameSpace
Dim mailFolder  As Object
Dim mailItem    As Object
Dim olApp       As Outlook.Application
Dim objUserType As Object

Set olApp = New Outlook.Application

Set NameSpace = olApp.GetNamespace("MAPI")
Set mailFolder = NameSpace.GetDefaultFolder(olFolderContacts)
Set mailItem = mailFolder.Items.Add("IPM.Contact.My_Contact")

mailItem.CompanyName = sCompany

mailItem.LastName = sLName
mailItem.FirstName = sFName
mailItem.Email1Address = sEMail
mailItem.HomeTelephoneNumber = sHPhone
mailItem.BusinessTelephoneNumber = sWPhone
mailItem.MobileTelephoneNumber = sMPhone
'mailItem.Subject = sName

mailItem.Save



Fri, 04 Oct 2002 03:00:00 GMT  
 Setting values to Custom Fields on Custom Forms
Try this:

mailItem.UserProperties("Type") = value1
mailItem.UserProperties("DX") = value

--
Sue Mosher
Author of
  "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
  "Microsoft Outlook 2000 E-mail and Fax Guide"

Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> Please help (again)

> I have a custome Contacts Form. In it I have placed a combo and tex box,
> cmbType and txtDX. I have also set these up as Custom fields, Type and DX
as
> text fields. The code below works fine to open up my customised form. How
do
> I set the values for Type and DX though?

> Dim NameSpace   As NameSpace
> Dim mailFolder  As Object
> Dim mailItem    As Object
> Dim olApp       As Outlook.Application
> Dim objUserType As Object

> Set olApp = New Outlook.Application

> Set NameSpace = olApp.GetNamespace("MAPI")
> Set mailFolder = NameSpace.GetDefaultFolder(olFolderContacts)
> Set mailItem = mailFolder.Items.Add("IPM.Contact.My_Contact")

> mailItem.CompanyName = sCompany

> mailItem.LastName = sLName
> mailItem.FirstName = sFName
> mailItem.Email1Address = sEMail
> mailItem.HomeTelephoneNumber = sHPhone
> mailItem.BusinessTelephoneNumber = sWPhone
> mailItem.MobileTelephoneNumber = sMPhone
> 'mailItem.Subject = sName

> mailItem.Save



Fri, 04 Oct 2002 03:00:00 GMT  
 Setting values to Custom Fields on Custom Forms
Thanks Sue, as usual it worked perfectly.



Quote:
> Try this:

> mailItem.UserProperties("Type") = value1
> mailItem.UserProperties("DX") = value

> --
> Sue Mosher
> Author of
>   "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
>   "Microsoft Outlook 2000 E-mail and Fax Guide"

> Outlook and Exchange solutions at http://www.slipstick.com



> > Please help (again)

> > I have a custome Contacts Form. In it I have placed a combo and tex box,
> > cmbType and txtDX. I have also set these up as Custom fields, Type and
DX
> as
> > text fields. The code below works fine to open up my customised form.
How
> do
> > I set the values for Type and DX though?

> > Dim NameSpace   As NameSpace
> > Dim mailFolder  As Object
> > Dim mailItem    As Object
> > Dim olApp       As Outlook.Application
> > Dim objUserType As Object

> > Set olApp = New Outlook.Application

> > Set NameSpace = olApp.GetNamespace("MAPI")
> > Set mailFolder = NameSpace.GetDefaultFolder(olFolderContacts)
> > Set mailItem = mailFolder.Items.Add("IPM.Contact.My_Contact")

> > mailItem.CompanyName = sCompany

> > mailItem.LastName = sLName
> > mailItem.FirstName = sFName
> > mailItem.Email1Address = sEMail
> > mailItem.HomeTelephoneNumber = sHPhone
> > mailItem.BusinessTelephoneNumber = sWPhone
> > mailItem.MobileTelephoneNumber = sMPhone
> > 'mailItem.Subject = sName

> > mailItem.Save



Sat, 05 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Custom Field Value Lists on Custom Forms

2. create custom icon,custom combobox(to insert values)in custom toolbar

3. Recurring-event Custom Meeting Forms Don't save custom fields

4. Custom Fields in Custom Forms

5. Set Custom Property Value through a VB Form

6. Setting Start field on custom form

7. how to get custom form and send custom form from VB

8. How to set programmatically set values of custom added columns

9. Passing the validated fields value to custom method in a field level validation

10. create custom icon,custom combobox in custom toolbar

11. Custom Property changes in Custom Outlook Form

12. batch-modifying custom field values in public folder

 

 
Powered by phpBB® Forum Software