How to acess the note field in contact item

Status
Not open for further replies.

laup

Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Please I am quite new to outlook programming. I have written a code to import data form an excel file to fill a contact item in outlook. How, I can important the data to fill the note field of the contact item.

Can anyone help me out of this problem, by giving me code or an idea how i can access the note field of a contact item using vba programming?

Many thanks in advance for your help.
 
Please i am new to outlook programming. I have written a code to import data form an excel list to fill the contact item in outlook. However, I have a problem of finding a way to fill the note column of the contact item.

Sheets("x").Activate
For i = 2 To Sheets("x").UsedRange.Rows.Count
Set outobj = outapp.CreateItem(olContactItem)
On Error Resume Next
outobj.Title = Sheets("x").Cells(i, 1)
outobj.FirstName = Sheets("x").Cells(i, 4)
outobj.LastName = Sheets("x").Cells(i, 3)
outobj.BusinessAddress = Sheets("x").Cells(i, 5)
outobj.Email1Address = Sheets("x").Cells(i, 9)
outob.note=Sheets("x").Cells(i,12)
outobj.Save
Next i

outob.note=Sheets("x").Cells(i,12) is not working. Please can someone help me to find a code or idea to to get the code fill the contactitem's note column?

Many thanks in advance.

Laup
 
Dear Adminstrator,

many thanks for the help. I will have this code implimented on Tuesday and I will then give you a feedback if it works.

For now thanks again for your help.

Laup
 
Dear Adminstrator,

yes, the code did work. Thanks a lot for this

However, I want to add the notes row by row. Can you please help me out with a code or give me an idea, how i can have the notes written row by row.

Thanks a lot in advance.

Laup
 
I'm not sure what you mean by row by row. The code that reads the xls sheet should do that, assuming row by row means for each contact record.
 
Thanks for the reply

I want that the notes appear line by line in a row as . For example
outob.body=Sheets("x").Cells(i,12)
outob.body=Sheets("x").Cells(i,13)
outob.body=Sheets("x").Cells(i,14)

However, I only get last code on the note field, that is
outob.body=Sheets("x").Cells(i,14)

I tried using outob.body=Sheets("x").Cells(i,12) & vbNewLine but it did not work. I used also outob.body=Sheets("x").Cells(i,12) & Chr(10) but it did not worked either. Is there a way to create paragraphs in the note field?

thanks in advance

Laup
 
vbcrlf should work - it's what I always use.

If you want to test different options, try vbcr, vblf, and chr(13) - they should work too, but I would have expected chr(10) to work, so who knows. :)
 
oh, and for this:

outob.body=Sheets("x").Cells(i,12)
outob.body=Sheets("x").Cells(i,13)
outob.body=Sheets("x").Cells(i,14)

you either need to use

outob.body=Sheets("x").Cells(i,12) & vbcrlf & Sheets("x").Cells(i,13) & vbcrlf & Sheets("x").Cells(i,14)
or

outob.body=Sheets("x").Cells(i,12)
outob.body=outob.body & vbcrlf & Sheets("x").Cells(i,13)
outob.body=outob.body & vbcrlf & Sheets("x").Cells(i,14)

I'd use the first method myself, maybe assigning the cell values to strings:

strLine1 =Sheets("x").Cells(i,12) & vbcrlf
strLine2=Sheets("x").Cells(i,13) & vbcrlf
strLine3=Sheets("x").Cells(i,14) & vbcrlf

outob.body=strLine1 & strLine2 & strLine3

You may need to use two vbcrlf - & vbcrlf & vbcrlf & for the line feeds.
 
Many thanks for the help. I will have the code implemented tommorrow and will then give you a feedback.

Secondly, I want to put the contacts extracted from the excel file in a subfolder in outlook. However anytime I try extracting the contactitems are put into the default folder instead, which I don't want.

Below my code:
Set olnamespace = outapp.GetNamespace("MAPI")
Set olfolder = olnamespace.GetDefaultFolder(olFolderContacts).Folders("D")
Set olitems = olfolder.Items

For i = 2 To Sheets("x").UsedRange.Rows.Count
Set outobj = outapp.CreateItem(olContactItem)
On Error Resume Next
outobj.Title = Sheets("x").Cells(i, 1)
outobj.FirstName = Sheets("x").Cells(i, 4)


I want the contact items to save in subfolder "D". Could you please give me an idea, how I could go around this problem again?

Many thanks in advance

Laup
 
May I need to implement the code like this:
olfolder.Items.Add ("outobj")

Is this correct?
 
Hallo Diane,

many thanks for the help. I will have it implemented tomorrow and then give you a feedback.

Laup
 
Hi Diane,

I just want to inform you that the code had worked. Many thanks for the help again.

Laup
 
Hallo Adminstrator,

I just want to also confirmed that the code had worked. Many thanks for help.

Laup
 
Hallo Diane, Hallo Adminstrator,

Please could help me with this problem again? I want to send contact items to a subfolder in our public folder. The path to the subfolder d, has the following structure.

Public Folder-laup@asn.de- All Public Folders-Folders (x)-subfolders(d). The contacts need to be save into subfolder "d"

My code reads:

'Set olfolder = olnamespace.Folders("Public Folders - laup@asn.de").Folders("All Public Folders").Folders("x").subfolders("d")
Set olitems = olfolder.items

My question is, can I use the following code to have contacts save into subfolder x directly? I don't want to impliement this code, because I don't know its consequences to existing contacts in the subfolder x.

I will be very grateful if can help me out again, by giving some advance.

Many thanks in advance.

Laup
 
This code:
'Set olfolder = olnamespace.Folders("Public Folders - laup@asn.de").Folders("All Public Folders").Folders("x").subfolders("d")

will save contacts to
\\Public Folders - laup@asn.de\All Public Folders\x\d
 
Hallo Diane,

Many thanks for the help. I have used the code and it has worked.

Once again thanks very much.

Laup
 
Hallo Diane, Hallo Adminstrator,

Please I want to add new contacts from an excel list to the public folder. Existing contactitems already in the public folder should have only their notes updated. Existing notes should not be replaced but the new notes should be added to them. If the contact is new, then it should be added the public folder.

My code should the following task done:
First i create a new contact, then I loop through existing contact in the public folder. I then compare Lastname and the Email of new contact with existing contact. If they are the same, then new notes to be added to existing notes. Otherwise the new contact should be added to the existing one.

The code reads:
for i =1 to ws1.usedrangeRow.Count
Set outobj = olfolder.Items.Add(olContactItem)
outobj.FirstName = ws1.Cells(i, 4)
outobj.Email1Address = ws1.Cells(i, 9)
For Each obitem In olitems
If obitem.Class = olContact Then
If outobj.LastName = obitem.LastName And outobj.EmailAddress = obitem.EmailAddress Then
ExistingNote=obitem.body
obitem.body=NewNotes & ExistingNote
end if
if obitem.LastName <> outobj.LastName And obitem.EmailAddress <> outobj.EmailAddress
Set outobj = olfolder.Items.Add(olContactItem)
outobj.Lastname= ws1.Cells.( i,2)
outobj.body=ws1.Cells(i,4)
end
next obitem

next i

I tried implimenting it but, it did not work. It was writing new notes on all existing notes of the contact items in the public folder. Please could help me out with a suggest solution.

Many thanks in advance for the help.

Laup
 
I want to extract contact form an excel list into Public Folder in outlook. For existing contacts only notes should be added. I have found a why to add new notes to existing ones. Since I have difficulties in writing a code to compare new contacts (Surname and Email) with existing ones, I have now change it just comparing the emails. My code reads:

for i =1 to ws1.usedrangeRow.Count
ExistingEmail = ws1.Cells(i, 9)
Set outobj = olfolder.Items.Find("ExistingEmail")
if not outobj=nothing then
outobj.body=ws1.cells(i,5).value
end if
next i

I don't want to have this code run until an expert can help. Can some please kindly let me know if the would work.

Will this work outobj.body=ws1.cells(i,5) and add notes to the contactitem?

Thanks

Laup
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Witzker Add a text line at the end of the note field in all selected Contacts Outlook VBA and Custom Forms 7
J images on note field display fraction of size Using Outlook 5
W Get a "New Note" icon onto the QAT Using Outlook 3
D IMP.Note Versus REPORt.IPM.NOte Outlook VBA and Custom Forms 3
M One Note as a mail folder Using Outlook 6
mrje1 Note Field (Any way to do incell editing) Using Outlook 7
J Outlook 2013 Want to file a note after filtering with search current mailbox Using Outlook 3
U No scrolling in note field of contact record Using Outlook 1
D Updating Registry to force new task and note items to save in a particular folder Using Outlook 1
L Contact Photo For Calendar Note Field Using Outlook 4
L Contact Photo For Calendar Note Field Using Outlook 0
N Adding a note to a e-mail which has been marked as follow up Using Outlook 1
L Outlook 2007 Code for Note Fields of Appointment Using Outlook 102
L Outlook 2007 Contact Form - Note Fields Using Outlook 25
G Problem with reminders and the contact note field BCM (Business Contact Manager) 5
W Calendar Note Font Reverting Using Outlook 11
M Unable to search Note section in Contacts in icloud Using Outlook 7
L Source Name for Appointment Note/Message field Using Outlook 0
J add note to body or notes Outlook VBA and Custom Forms 5
0 Add a date stamp to the note field of a custom form Outlook VBA and Custom Forms 1
S Note: The GMT offset above does not reflect daylight saving time adjustments Using Outlook 12
M Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO? Outlook VBA and Custom Forms 4
A Note field on general tab BCM (Business Contact Manager) 5
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Outlook VBA forward the selected email to the original sender’s email ID (including the email used in TO, CC Field) from the email chain Outlook VBA and Custom Forms 2
D Outlook 365 Custom forms field limit? Outlook VBA and Custom Forms 4
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
S Combination Field (Date Format) Outlook VBA and Custom Forms 0
M copy field value to custom field Outlook VBA and Custom Forms 0
C Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 4
J How to create a drop down user defined field that will appear on an inbox view Outlook VBA and Custom Forms 8
C Move or copy from field to field Outlook VBA and Custom Forms 0
O Filter-Query Builder-Description - what field name to use? Using Outlook 4
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
N Contact Form Notes Field Touch vs Mouse Using Outlook 0
S CONTACT FIELD PRINT ORDER Outlook VBA and Custom Forms 1
V Checking for empty field Outlook VBA and Custom Forms 2
V Update new custom field Outlook VBA and Custom Forms 5
HappyDaddy007 "Size" on field chooser/column displaying incorrect value Using Outlook 3
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4
H Information from user defined field into Excel Outlook VBA and Custom Forms 7
I Outlook 2003 shows html code when To: field is empty Using Outlook 7
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
D Outlook Contacts Notes Field Photos to Smartphone Using Outlook 0
S Custom Field Cannot Be Displayed In Views Outlook VBA and Custom Forms 2
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
S Create a clickable custom column field Outlook VBA and Custom Forms 0
B User defined field for messages with 'me' in the [To], [Cc] line Using Outlook 0

Similar threads

Back
Top