A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook 2007 - Getting Note Body



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 24th 07, 02:55 PM posted to microsoft.public.outlook.program_vba
DanielLipkie
external usenet poster
 
Posts: 4
Default Outlook 2007 - Getting Note Body

With Access & Outlook 2003 I had Access code that read through the Notes
folder with
Dim fldFolder As Outlook.MAPIFolder
Dim objItems As Items
Dim objItem As Object
Dim oNoteItem as As Outlook.NoteItem
Set fldFolder =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)
Set objItems = fldFolder.Items
objItems.Sort "Subject"
For Each objItem In objItems
Set oNoteItem = objItem
... then code to use oNoteItem.Body, oNoteItem.Subject

But this same code fails on the fldFolder.Items with Access/Outlook 2007.
Run-time error 80040155, Method "Items' of object MAPIFolder failed.

What is the correct coding style for accessing/modify Notes with 2007. A
pointer to Knowledge base article would be appreciated. I've trying replacing
the above style with using the new Table object but can't find a way to get a
"Body" column. The default columns contain only Subject. Columns.RemoveAll
followed by Columns.Add ("Body") fails.

Hints, pointers to overviews on handling issues of Access/Outlook 2003-2007
vba conversion would be appreciated.

Daniel

  #2  
Old May 24th 07, 06:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook 2007 - Getting Note Body

I wouldn't expect to be able to use anything much with Notes and have it
work, they're brain dead and have been since Outlook 97. Just stick with the
normal exposed properties for a Note item and you should be OK. Trying to do
anything fancy with Notes is a waste of time.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"DanielLipkie" wrote in message
...
With Access & Outlook 2003 I had Access code that read through the Notes
folder with
Dim fldFolder As Outlook.MAPIFolder
Dim objItems As Items
Dim objItem As Object
Dim oNoteItem as As Outlook.NoteItem
Set fldFolder =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)
Set objItems = fldFolder.Items
objItems.Sort "Subject"
For Each objItem In objItems
Set oNoteItem = objItem
... then code to use oNoteItem.Body, oNoteItem.Subject

But this same code fails on the fldFolder.Items with Access/Outlook 2007.
Run-time error 80040155, Method "Items' of object MAPIFolder failed.

What is the correct coding style for accessing/modify Notes with 2007. A
pointer to Knowledge base article would be appreciated. I've trying
replacing
the above style with using the new Table object but can't find a way to
get a
"Body" column. The default columns contain only Subject.
Columns.RemoveAll
followed by Columns.Add ("Body") fails.

Hints, pointers to overviews on handling issues of Access/Outlook
2003-2007
vba conversion would be appreciated.

Daniel


  #3  
Old May 24th 07, 08:36 PM posted to microsoft.public.outlook.program_vba
DanielLipkie
external usenet poster
 
Posts: 4
Default Outlook 2007 - Getting Note Body

Even though Note "have been brain dead since Outlook 97" ... I still have a
need to be able to read/edit/create Notes (Contacts, Mail Items) in Outlook
2007 using VBA code in Access 2007.

I've read that MAPIFolder no longer exists in the Outlook 12.0 Object
library and has been replaced by Outlook.Folder. But I still can't seem to
find a way to get to the items in a notes folder.

Dim oFld as Outlook.Folder
Set oFld =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)

seem to get me a valid oFld object. II add it to the watch window and set a
break point after the above code and the object looks fine. It has the
correct number of Items in the watch window but

dim oItems as Items
Set oItems = oFld.Items

crashes.

What am I doing wrong? Where can I find code example for read/edit/create
Outlook 2007 mail, note, contact items using vba code from an Access 2007?

Daniel



  #4  
Old May 25th 07, 08:18 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Outlook 2007 - Getting Note Body

Your code ran fine here in Access 2007 after I fixed the typo in the NoteItem declaration. Outlook was already running.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"DanielLipkie" wrote in message ...
Even though Note "have been brain dead since Outlook 97" ... I still have a
need to be able to read/edit/create Notes (Contacts, Mail Items) in Outlook
2007 using VBA code in Access 2007.

I've read that MAPIFolder no longer exists in the Outlook 12.0 Object
library and has been replaced by Outlook.Folder. But I still can't seem to
find a way to get to the items in a notes folder.

Dim oFld as Outlook.Folder
Set oFld =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)

seem to get me a valid oFld object. II add it to the watch window and set a
break point after the above code and the object looks fine. It has the
correct number of Items in the watch window but

dim oItems as Items
Set oItems = oFld.Items

crashes.

What am I doing wrong? Where can I find code example for read/edit/create
Outlook 2007 mail, note, contact items using vba code from an Access 2007?

Daniel



  #5  
Old May 26th 07, 10:31 PM posted to microsoft.public.outlook.program_vba
DanielLipkie
external usenet poster
 
Posts: 4
Default Outlook 2007 - Getting Note Body

Thanks for the reply (looking forward to release of your 2007 book).

I'm still having problems. The code below in Access 2007
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.Folder
Dim olItems As Items

Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderNotes)
Set olItems = olFolder.Items

throws an "interface not found" on olFolder.Items for Inbox and Notes
folders. I'm running Vista Home Premium, Office 2007 ultimate. Pretty
straight forward but can't seem to get it to work. I'm trying to find a way
to do simple read/edit/create/delete using Items on the default notes and
contacts folders. I know the Table feature is the preferred way to get to
data but I think I need to use Items for notes since the body is RTF and
Table does not support an RTF column.

Daniel

"Sue Mosher [MVP-Outlook]" wrote:

Your code ran fine here in Access 2007 after I fixed the typo in the NoteItem declaration. Outlook was already running.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"DanielLipkie" wrote in message ...
Even though Note "have been brain dead since Outlook 97" ... I still have a
need to be able to read/edit/create Notes (Contacts, Mail Items) in Outlook
2007 using VBA code in Access 2007.

I've read that MAPIFolder no longer exists in the Outlook 12.0 Object
library and has been replaced by Outlook.Folder. But I still can't seem to
find a way to get to the items in a notes folder.

Dim oFld as Outlook.Folder
Set oFld =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)

seem to get me a valid oFld object. II add it to the watch window and set a
break point after the above code and the object looks fine. It has the
correct number of Items in the watch window but

dim oItems as Items
Set oItems = oFld.Items

crashes.

What am I doing wrong? Where can I find code example for read/edit/create
Outlook 2007 mail, note, contact items using vba code from an Access 2007?

Daniel




  #6  
Old May 27th 07, 02:13 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Outlook 2007 - Getting Note Body

Did you try it with Outlook already running? That would be useful for troubleshooting this. It also wouldn't hurt to run Office Diagnostics and turn off any anti-virus application.

The Body doesn't return RTF content for any object, BTW.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"DanielLipkie" wrote in message ...
Thanks for the reply (looking forward to release of your 2007 book).

I'm still having problems. The code below in Access 2007
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.Folder
Dim olItems As Items

Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderNotes)
Set olItems = olFolder.Items

throws an "interface not found" on olFolder.Items for Inbox and Notes
folders. I'm running Vista Home Premium, Office 2007 ultimate. Pretty
straight forward but can't seem to get it to work. I'm trying to find a way
to do simple read/edit/create/delete using Items on the default notes and
contacts folders. I know the Table feature is the preferred way to get to
data but I think I need to use Items for notes since the body is RTF and
Table does not support an RTF column.

Daniel

"Sue Mosher [MVP-Outlook]" wrote:

Your code ran fine here in Access 2007 after I fixed the typo in the NoteItem declaration. Outlook was already running.

"DanielLipkie" wrote in message ...
Even though Note "have been brain dead since Outlook 97" ... I still have a
need to be able to read/edit/create Notes (Contacts, Mail Items) in Outlook
2007 using VBA code in Access 2007.

I've read that MAPIFolder no longer exists in the Outlook 12.0 Object
library and has been replaced by Outlook.Folder. But I still can't seem to
find a way to get to the items in a notes folder.

Dim oFld as Outlook.Folder
Set oFld =
Outlook.Application.GetNamespace("MAPI").GetDefaul tFolder(olFolderNotes)

seem to get me a valid oFld object. II add it to the watch window and set a
break point after the above code and the object looks fine. It has the
correct number of Items in the watch window but

dim oItems as Items
Set oItems = oFld.Items

crashes.

What am I doing wrong? Where can I find code example for read/edit/create
Outlook 2007 mail, note, contact items using vba code from an Access 2007?

Daniel




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update meeting body not being retained in Outlook 2007 Justin T Outlook - Calandaring 0 April 12th 07 05:12 PM
Outlook 2007 COM Addin Hang while typing in message body Mikey Outlook - Using Forms 3 March 28th 07 02:59 PM
Can't see new emails body with Outlook 2007 Beta Onesolo Outlook - Installation 21 November 23rd 06 03:05 AM
Problem with Outlook 2007 B2 - new messages not displaying body Chris Ericoli Outlook - General Queries 2 June 6th 06 09:44 PM
Read contents of Note inserted in Outlook Contact Item Body JPL Outlook and VBA 4 June 5th 06 09:19 PM


All times are GMT +1. The time now is 12:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.