![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Try adding statements to log onto the desired mail profile:
Set ns = OutlookApp.GetNamespace("MAPI") ns.Logon "name of profile -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Peter" wrote in message ... 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. "Sue Mosher [MVP-Outlook]" wrote in message ... 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? "Peter" wrote in message ... 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? 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) "Peter" wrote in message ... Outllook 2003 on XP Pro I am trying to open Outlook and crate a message from Excel VBA module and I am getting the following error The Operation failed. - -2147287037: In RunExportProgram Function (Every thing works fine if Outlook is already open, but not when it's closed) The same code works fine on other computers even when Outlook is closed. Here's the code: Dim OutlookApp As Object Set OutlookApp = CreateObject("Outlook.Application") Set Message = OutlookApp.Application.CreateItem(0) ' -- This is where the error occurs Thanks 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 --------------------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Automate Outlook username and server | Sam Stamp | Outlook - Installation | 2 | December 13th 07 07:02 AM |
automate Outlook..insert signiture | SAm | Outlook and VBA | 1 | July 25th 07 10:24 PM |
Outlook to read emails and automate to do some work | Chirag Chokshi | Outlook and VBA | 1 | July 3rd 07 04:32 PM |
Automate email and attach excel worksheet or workbook | wilma2299 | Outlook and VBA | 3 | April 13th 07 06:06 AM |
Automate Outlook Profiles ... Newprof and PRF | DemoDog | Outlook - Installation | 3 | January 17th 06 02:06 PM |