Rick, Thanks for that. I found out the real underlying problem though and it's all to do with permissions (Windows 7 here). If you run in development mode and have outlook already open then it would seem that because the original outlook was NOT opened from VFP then windows sees it as running under a sort of "protected thread".
Also, you no longer need the GetObj() with Outlook 2007 (Windows 7) and above as the CreateObject() will create an object reference regardless of whether Outlook is open or not but ONLY in runtime mode when Outlook has been open with the same user authority as the runtime VFP application. The problem was masked as the upgrade to Outlook 2007 was done at the same time as XP to Windows 7 which is what threw me a little. Oh well, another 4 hours wasted!!! Well not wasted as at least it works OK now. Dave -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Rick Schummer Sent: 21 October 2011 12:51 To: [email protected] Subject: RE: Automating Outlook 2007 Hi Dave, >> The new version of Outlook allows the CreateObject() no problem but if >> outlook is already open the Create obviously fails but the GetObj() refuses to get a reference and returns back an OLE error code "0x800401ea: Moniker cannot open file" You can't use the CreateObject() if Outlook is open as it returns back error 0x80080005: Server execution failed after bringing up a "This action cannot be completed because the other application is busy. Choose "Switch to" to activate the busy program and correct the problem"<< When I run this code the TRY side executes fine with an instance of Outlook open using Outlook 2010. If I create a second TRY...CATCH with a second variable the TRY side executes fine. Rick White Light Computing, Inc. www.whitelightcomputing.com www.swfox.net www.rickschummer.com [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

