Outlook 2007 Update Fields Thru Tasks

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
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:

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

LMS

Senior Member
Outlook version
Email Account
Exchange Server
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
 

Forum Admin

Senior Member
So you want to select a task and update the associated contact? What field value do you want to send to contacts?
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
I have a long list of fields....so in the Userform it shows each field name and at the end of the top code the following is the list of fields and then each one show in the Useform code the different values that I can put in...so if there is something that the code needs to specific fields, the ones below are the fields that are after the words Me.ddlFields.addItem....so anyway to do this?

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"
 

Forum Admin

Senior Member
You want to add the value of each of these fields to custom fields in the contact or to the notes field of the contact?
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
To the custom fields. So above you for example see the field 'Next Step'. In the code where you see the Case of thar name, in adding tge vale, i have a list of words which show up as a droplist in the userform and whatever i select it puts it in the field Next Step of the contact.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You'll need to do something like

ocontact.UserProperties.Item("FieldName"). = otask..UserProperties.Item("FieldName")

i can't test it since it uses custom forms, but after you set the value in tasks, you need to push that value back to the contact
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
The goal is to just change the fields of the contact that the task is assigned to . Not change a task field, just update the task re the contact.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Oh, then you need to read the fields in the contact and set the task field using those values.

otask.UserProperties.Item("FieldName"). = ocontact.UserProperties.Item("FieldName")
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
So what to change re the code so the fields and related words go to the fields of the Contact. AndSo where do I put that code line you just wrote down which updates the Task field from the contact i changed?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I can't test it since my outlook version doesn't use links, but you need to put it in the macro you are using to write the changes to the contact.

Assuming you are using this code, it would replace this line
myItem.UserProperties.Item(FieldName).value = myValue

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
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
Thank you but I misunderstand. What code line do I replace [FONT=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif]myItem.UserProperties.Item(FieldName).value = myValue ?[/FONT]
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
you need to replace

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

with

otask.UserProperties.Item("FieldName") = ocontact.UserProperties.Item("FieldName")

Don't forget to adjust your object names so they match throughout the macros.
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
So also don't understand how to adjust your object names so they match throughout the macros.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I know you do, because we've been through it before. :)

The things in bold may need to be changed if you are using something different to identify the tasks and contact

otask.UserProperties.Item("FieldName") = ocontact.UserProperties.Item("FieldName")
 

LMS

Senior Member
Outlook version
Email Account
Exchange Server
I replaced what you told me to do and when I ran the Userform to change the fields of the contact that is assigned to the Task that I select, it does not change the fields but there is no error. What else to try please?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Outlook 2007 update headers Using Outlook 2
P Outlook 2007: Update the Contacts folder entries Outlook VBA and Custom Forms 2
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3
icacream From Outlook 2007 to 2016 ! Using Outlook 9
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S Outlook 2007: Address Cards allow entering text! Why? Using Outlook 3
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
C Move from Outlook 2007 Enterprise (MOE) to Outlook Pro plus 2007 Using Outlook 1
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
P outlook addin unloaded in office 2007 Using Outlook 0
B Fonts in Outlook 2007 Using Outlook 4
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
C out of space in file group Outlook 2007 Using Outlook 2
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
P Outlook 2007 Email Categorization using VBA Outlook VBA and Custom Forms 1
M Unable to Configure Gmail Account in Outlook 2007 Using Outlook 1
R Outlook 2007 or 2010 - Lock Down Functionality Outlook VBA and Custom Forms 3
S Outlook 2007, windows 10 Font size Using Outlook 1
Diane Poremsky Manually create a POP3 account in Outlook 2007 Using Outlook 0
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
L Outlook 2007 Font Using Outlook 3
J Outlook 2007 connector and Windows 10 Using Outlook 3
R Outlook 2007 - Shared Accounts and Resources without Exchange Server Using Outlook 0
L Outlook 2007 - Macro Re Search Using Outlook 16

Similar threads

Top