The cause may be an anti-virus program on your computer that has a feature to block Outlook scripting. If so, the solution is to turn off the script blocking feature. You may need to contact technical support for your anti-virus program to find out how to do that.
I've also seen reports that setting the server parameter can resolve this problem in some situations:
Set ol = CreateObject("Outlook.Applicaton", localhost)
Also, you can simplify your statement creating a new message to:
Set Message = OutlookApp.CreateItem(0)

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
The cause may be an anti-virus program on your computer that has a feature
to block Outlook scripting. If so, the solution is to turn off the script
blocking feature. You may need to contact technical support for your
anti-virus program to find out how to do that.
I've also seen reports that setting the server parameter can resolve this
problem in some situations:
Set ol = CreateObject("Outlook.Applicaton", localhost)
Also, you can simplify your statement creating a new message to:
Set Message = OutlookApp.CreateItem(0)

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
> Outllook 2003 on XP Pro
>
[quoted text clipped - 19 lines]
>
> Peter
I have not tried the Antivirus thing yet because I don't have access to the
specific computer at this time, but when try
Set ol = CreateObject("Outlook.Applicaton", "localhost")
or
Set ol = CreateObject("Outlook.Applicaton", "<actual-name.domain.com>")
I get the following error on a computer that Outlook does open by the code.
---------------------------
Microsoft Excel
---------------------------
Class not registered on local machine - 463: In RunExportProgram Function
---------------------------
OK
---------------------------
Peter - 22 Jan 2008 15:03 GMT
Never Mind - spelling error.
Sorry about that !!!
> The cause may be an anti-virus program on your computer that has a feature
> to block Outlook scripting. If so, the solution is to turn off the script
[quoted text clipped - 52 lines]
> OK
> ---------------------------
Peter - 01 Mar 2008 14:10 GMT
I have disabled the Anti Virus program and still getting the same error
message. (I've stopped or disabled as many programs as I could, but the
error persists).
What else can I check or try?
Thank You
>> The cause may be an anti-virus program on your computer that has a
>> feature to block Outlook scripting. If so, the solution is to turn off
[quoted text clipped - 52 lines]
>> OK
>> ---------------------------
Sue Mosher [MVP-Outlook] - 01 Mar 2008 18:38 GMT
Did you try the alternate version of the CreateObject expression? Does the expression OutApp Is Nothing return True? Does the VBA environment have a reference set to the Microsoft Outlook library?

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
> I have disabled the Anti Virus program and still getting the same error
> message. (I've stopped or disabled as many programs as I could, but the
[quoted text clipped - 57 lines]
>>> OK
>>> ---------------------------
Peter - 02 Mar 2008 13:39 GMT
Here's the updated code:
Dim OutlookApp As Object
Dim Message As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set Message = OutlookApp.CreateItem(0) ' <== fails here
Message.Display
''''
'OutlookApp Is Nothing' returns False
VBA environment does not set reference to Outlook library, because I am
using late binding. I have tried setting the reference and using early
binding code, but got the same error.
The same code works fine when Outlook is already running, but fails when
Outlook is not started.
I have found this this error description: -2147287037 (80030003) The path %1
could not be found.
But path to what? It can not be path to Outlook executable, because the
Outlook does load into memory after executing Set OutlookApp =
CreateObject("Outlook.Application") statement. but it disappears from memory
after Set Message = OutlookApp.CreateItem(0) statement.
Did you try the alternate version of the CreateObject expression? Does the
expression OutApp Is Nothing return True? Does the VBA environment have a
reference set to the Microsoft Outlook library?

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
> I have disabled the Anti Virus program and still getting the same error
> message. (I've stopped or disabled as many programs as I could, but the
[quoted text clipped - 62 lines]
>>> OK
>>> ---------------------------
Sue Mosher [MVP-Outlook] - 02 Mar 2008 19:47 GMT
Try adding statements to log onto the desired mail profile:
Set ns = OutlookApp.GetNamespace("MAPI")
ns.Logon "name of profile

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
> Here's the updated code:
>
[quoted text clipped - 93 lines]
>>>> OK
>>>> ---------------------------