You cannot access an open instance of Outlook by using CREATEOBJECT in FoxPro. You need to use GETOBJECT, and then you need to refer to the specifics you're using.
Some other suggestions:
- Don't use single-letter variable names, even if they're not in the short list where FoxPro complains.
- Test that
o
is an object and in a good state before doing anything with it. - Don't use
AcitveInspector
or its office-kin unless you're looking for something the user is currently looking at. In an example like this, you should be searching the API for how to filter each email item by itself. - While i'm not 100% familiar on Outlook's internal mechanism, if you've got the user's email in a directory of files ALREADY, you really should just see if you can filter that instead. MIME parsers aren't hard to come by if it's in native format, and if it's XML the DOM is easier than VBA.