View Single Post
  #4  
Old July 30th 08, 02:15 PM posted to microsoft.public.access.formscoding,microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using VBA in Access to Create an Outlook Distribution List (Office 2007)

Application.GetNameSpace() only has meaning in an Outlook VBA project. In a
Word VBA project "Application" is Word, in an Excel VBA project it's Excel,
etc. So if not in Outlook then you must use an explicit Outlook.Application
object and instantiate it.

If objRecip.Application.IsTrusted == false then that definitely explains why
you aren't getting a Recipient object, Outlook doesn't trust your code. Why
that is I have no idea.

See if any of the Outlook 2007 specific information at
http://www.outlookcode.com/article.aspx?id=52 gives you any clues as to
what's going on. At least you now know it's a trust issue and not a coding
issue.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Don" wrote in message
...

Ken,

I tried your suggestion of simplifying. While I no longer get the 287
error, objRecip does not contain anything after the assignment. Some
observations:

1) Set oNS = Application.GetNamespace("MAPI") throws a "Method or Data
Member not Found" on GetNamespace when I try to compile or execute.
Instead
I use:
Set olApp = New Outlook.Application
Set oNS = olApp.GetNamespace("MAPI")
Could this be the cause of the problem with objRecip?

2) Trust Center in Outlook appears to be set to allow programmatic
execution from an application outside of Outlook. The radio button is set
to warn if the anti-virus is out of date or invalid. (The selection is
greyed out since as a regular user I am not allowed to change it.) And it
says the AV is valid (Symantec Corporate edition)

3) objRecip.Application.IsTrusted is set to FALSE -- this is troubling.
The way I read the manual
(http://msdn.microsoft.com/en-us/library/bb207708.aspx) Outlook will not
trust the object and presumably therefore not allow it to be set.

Suggestions?

Thanks!

Don


Ads