Outlook 2007 Update Fields Thru Tasks

Status
Not open for further replies.
add a debug.print right before it to make sure it's reading the fields. I'm assuming it is, but that will eliminate one source of problems.
 
What full words re debug.print I put in before the other words you gave me to change?
 
I put the words Debug.Print above otask.UserProperties.Item("FieldName") = oContact.UserProperties.Item("FieldName") and no error when I ran the Userform.....
 
You need more than debug.print - you need to include what you want to print, then look in the Immediate window to see the results.

I'd use

Debug.Print "task: " & otask.UserProperties.Item("FieldName") & " - Contact: " & oContact.UserProperties.Item("FieldName")

above

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

see if the expected values are listed in the immediate window when it runs.
 
Thanks much...will try it...and also, in the words "FieldName" I am using that name...not the name of a field in the contacts I changing many fields.......
 
you need to use the fieldname - if its the CalledLast field you need to use

otask.UserProperties.Item("CalledLast")
 
And the same for oContact.UserProperties.Item("FieldName") ??
 
I did this and nothing happened:

Debug.Print "task: " & otask.UserProperties.Item("First Status:") & " - Contact: " & oContact.UserProperties.Item("First Status:")
otask.UserProperties.Item("First Status:") = oContact.UserProperties.Item("First Status:")
 
First - are you referring to the task as oTask and the contact as oContact? (Should be, or you're get an object not found error.)

So... if nothing is printed in the Immediate window, it means the code is wrong. (DUH! ;)) Is 'first status:' the field name or the label name? You need to use the field name.
 
If you see above, I used what you told me.....

Debug.Print "task: " & otask.UserProperties.Item("First Status:") & " - Contact: " & oContact.UserProperties.Item("First Status:")

otask.UserProperties.Item("First Status:") = oContact.UserProperties.Item("First Status:")

And "First Status:" is the field name of the Contact, not the label name.

What else to do please?​







 
id you step through the macro, does it jump over the lines? if you have on error resume next or other error handler, comment it out so you can see where it stops. I don't see anything in the code that should cause problems and I'm out of ideas on it. :(
 
There are no errors. It just dos not change the field in the contact.
 
Open a contact (or task, whatever you need to test this) then use F8 to step into the macro and watch which lines it skips.
 
As you know, in the begining of this thread, I showed the the Userfom and the connected Module, has the Useform has the fields of the contact, I run it, and decide what words to put in the fields of each contact. So we just trying to set it up so that I select task(s) it goes to the contact of each task and does the same.

I was giving by someone else the following code to use for the Module and the error is that an object cannot be found and it yellows the following line:

Set c = f.items(conts(cq))

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

Dim tsk As taskItem, c As contactItem, f As MAPIFolder

Set f = Application.GetNamespace("mapi").GetDefaultFolder(olFolderContacts)

For Each tsk In ActiveExplorer.Selection
conts = Split(tsk.ContactNames, ",")
For cq = 0 To UBound(conts)
Set c = f.items(conts(cq))
c.UserProperties.Item(FieldName).value = myValue
c.Save
Next

Next

End Sub
 
That means one of the objects in Set c = f.items(conts(cq)) is not seen by the code or does not exist but it looks like everything exists. Does the selected task have a contact assigned?
 
I think so as in a contact, I have that script code that creates a task to that contact and the contact link is at the bottom of the task.
 
That means one of the objects in Set c = f.items(conts(cq)) is not seen by the code or does not exist but it looks like everything exists. Does the selected task have a contact assigned?
 
You repeated what you said above and I wrote back : I think so as in a contact, I have that script code that creates a task to that contact and the contact link is at the bottom of the task.
 
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
D Outlook 2007 Recovering E-Mails Using Outlook 0
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

Similar threads

Back
Top