VBA and Outlook Note Items

K

komobu

Hi;

I am wanting to search through notes with vba script. It doesnt allow
me to search the body of the message, only the subject. I want to give
my notes a specific subject but I am recieving an OLE error stating
that the subject is "Read-Only" Is there a work around for this?

Also How can I delete all the notes in a category through vba script? I
am wanting to have my app automatically create notes for personnel in
the section. As the personnel leave, I want their notes automatically
deleted. The easiest way I can think of is to delete all the notes, and
then have my app re-write them.

Thanks for any help.

Pat
 
D

David C. Holley

I was just snooping around OUTLOOK Help under NoteItems. If I recall,
the SUBJECT is the BODY because of the nature of the NoteItem object.
Pull up the OUTLOOK VBA Editor and then go over to HELP. You'll find the
information under Microsoft Outlook Object Model>OBJECTS>NOTEITEM
 
S

Sue Mosher [MVP-Outlook]

A workaround is to create a new item with the same Subject and Body and delete the old one with the Delete method.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Michael Bauer

Am 30 Sep 2005 04:30:26 -0700 schrieb komobu:

Pat, a Note´s subject is its first body line. The first line is all the
text before the first vbCRLF characters.

Here´s a sample for deleting, assuming oFolder is set to the proper
folder.

Dim obj as object
Dim oNote as Outlook.NoteItem
Dim oFolder as MapiFolder
....
While oFolder.Items.Count
set obj=oFolder.Items(1)
If TypeOf obj is OUtlook.NoteItem then
set oNote=obj
If InStr(1, oNote.Categories, "YourCategoryHere", vbTextCompare) then
oNote.Delete
Endif
Endif
Wend
 
M

Michael Bauer

Am Fri, 30 Sep 2005 16:07:50 +0200 schrieb Michael Bauer:

Autsch, did you try the sample? Then it´s probably still running...

Because you aren´t deleting all items there must be a different loop:

Dim i&
For i=oFolder.Items.Count To 1 Step -1
Set obj=oFolder.Items(i)
...
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top