RSS feed inbox "new item event"?

  • Thread starter Thread starter Accessor
  • Start date Start date
A

Accessor

Hi all. I've been working with access and excel vba for a couple years, and
I'm just about to try and get my feet wet in outlook. I subscribe to several
RSS feeds, and get dozens of messages on each a day. A couple of the feeds
are of more interest than the rest. What I'd like to do is, if a new feed
comes in from a service of interest, trigger a form. I'd like the form to
display in controls the subject line seperate from the body. If it's a point
of interest, I'll have an "add to database" button which will write a record
to my access database. If I can get as far as displaying the item on the
form, I can probably figure out the rest.

Can I get a nudge in the right direction? At the moment I can't seem to find
more than how to work with my standard inbox in a relatively basic fashion.
Many thanks in advance.
 
You will need to process the RSS folder with the Folder.Items.ItemAdd event;
see http://www.outlookcode.com/article.aspx?id=62 for an example. To return a
non-default folder, you need to walk the folder hierarchy using the Folders
collections or use a function that does that for you. For examples, see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder path string
http://www.outlookcode.com/codedetail.aspx?id=492 - searches for a folder by
name

The object browser will show you the names of standard properties you can
use to populate your VBA userform with information from the item.
 
Hi Sue, thanks for the reply. I was just earlier today looking at you site
thinking how I need to pick up a copy of your book. :) So being a total
greenhorn, this is what I have thus far, my attempts based on your links
provided, not yet working:

Option Explicit

Private WithEvents olRSSItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session
' instantiate objects declared WithEvents
Set olRSSItems = objNS.GetFolderByName("Option Monster Trader's News").Items
Set objNS = Nothing
End Sub

Private Sub olRSSItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Item.BodyFormat = olFormatPlain
Item.Save
Set Item = Nothing
End Sub

Am I in the ballpark? Apparently I'm trying to use the function incorrectly,
I thought the purpose was to pass a folder in code when just knowing it's
name... thanks again.
 
You'd need to add the GetFolderByName function to a code module, too, of
course, but that looks like it's on the right track.

You say it's not yet working, but what specifically does that mean? Are you
getting errors?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Hey there.

I did add that function to a module, yup. I'm trying to not ask to be too
"spoon fed" here, but when I F5 it, I get the error "object doesn't support
this property or method" on the line "Set olRSSItems"
 
Sorry I missed this the first time: GetFolderByName is a custom function,
not a method of the Namespace object, so the proper usage would be:

Set olRSSFolder = GetFolderByName("Option Monster Trader's News")
If Not olRSSFolder Is Nothing Then
Set olRSSItems = olRSSFolder.Items
Else
MsgBox "folder not found"
End If

Note how you should get the folder first, test for its existence, then move
on to the Items collection.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
That seems to have done the trick. I knew better as well. Funny, when you're
just a little bit out of your element (new VBA objects) some skills that
should be ingrained can slip. You're the best!
 
Back
Top