I have a code for a Userform that is connnected to Module code, and when I select a list of different contacts without opening them, the Userform shows in the drop list difference fields that are in all contacts, and a select a field from the Userform and it shows the list of words I can put in each same field of all contacts I selected.


So what I want to do, is when I create a task for different contacts, in task area is shows the name of each contact as usual. So want to select the tasks as to the contacts I want to change the fields to, and then run the Userfom and change the fields of each contact of each Task.


So in looking at the two codes, does anyone know what to change so it changes the fields of each contact thru the tasks I select?

Here is the Userform code and below it is the Module code that goes to the Userform:

Private Sub btnRun_Click()    Dim Field As String
    Dim value As String
    Field = Me.ddlFields.Text
    value = Me.ddlValues.Text
    
   
        UpdateContactFieldTasks Field, value
      
    Me.Hide
    
End Sub


Private Sub ddlFields_Change()


    Dim fld As String
    fld = Me.ddlFields.Text
    'Add your field related values here.
    
    Select Case fld


    Case "Status Date"
   
       For M = 1 To 12
        For i = 1 To Day(DateSerial(Year(Now), Month(Now) + M, 1) - 1)
            Me.ddlValues.addItem Format(DateSerial(Year(Now), Month(Now) + M - 1, i), "mmm-dd-yyyy")
        Next
    Next
    
    Case "First Status:"
    
Me.ddlValues.addItem ""
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"




    Case "Next Status Date:"
 For M = 1 To 12
        For i = 1 To Day(DateSerial(Year(Now), Month(Now) + M, 1) - 1)
            Me.ddlValues.addItem Format(DateSerial(Year(Now), Month(Now) + M - 1, i), "mmm-dd-yyyy")
        Next
    Next


    Case "Related Status"
Me.ddlValues.addItem ""
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"






    Case "Last Status Date"
  For M = 1 To 12
        For i = 1 To Day(DateSerial(Year(Now), Month(Now) + M, 1) - 1)
            Me.ddlValues.addItem Format(DateSerial(Year(Now), Month(Now) + M - 1, i), "mmm-dd-yyyy")
        Next
    Next


    Case "Last Status"
Me.ddlValues.addItem ""
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"






    Case "Follow-Up?"
        Me.ddlValues.addItem ""
        Me.ddlValues.addItem "Yes"
        Me.ddlValues.addItem "No"
        Me.ddlValues.addItem "Maybe"
        Me.ddlValues.addItem "Decide Later"
        
    Case "Date to Follow- Up"
  For M = 1 To 12
        For i = 1 To Day(DateSerial(Year(Now), Month(Now) + M, 1) - 1)
            Me.ddlValues.addItem Format(DateSerial(Year(Now), Month(Now) + M - 1, i), "mmm-dd-yyyy")
        Next
    Next


    Case "Next Step"
Me.ddlValues.addItem ""
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
Me.ddlValues.addItem "Words"
  
    End Select
    
End Sub


Private Sub UserForm_Initialize()
    'Add your field names here.
    
    Me.ddlFields.addItem "Status Date"
    Me.ddlFields.addItem "First Status:"
    Me.ddlFields.addItem "Next Status Date:"
    Me.ddlFields.addItem "Related Status"
    Me.ddlFields.addItem "Last Status Date"
    Me.ddlFields.addItem "Last Status"
    Me.ddlFields.addItem "Follow-Up?"
    Me.ddlFields.addItem "Date to Follow- Up"
    Me.ddlFields.addItem "Next Step"
        
End Sub


Public Sub UpdateContactFieldTasks(ByVal FieldName As String, ByVal myValue As String)


Dim objApp As outlook.Application
Dim myItem As outlook.ContactItem
Dim X As Integer
Dim Selected As Integer
X = 1
Set objApp = Application

On Error Resume Next

Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
For Each Item In objApp.ActiveExplorer.Selection
Selected = objApp.ActiveExplorer.Selection.Count
Do While X <= Selected
Set myItem = objApp.ActiveExplorer.Selection.Item(X)

myItem.Visible = False
myItem.UserProperties.Item(FieldName).value = myValue

myItem.Display
myItem.Save

X = X + 1
Loop

Next

End Select

Set objApp = Nothing

End Sub


[/CODE]