Runtime Error 0x???04005

Status
Not open for further replies.
L

.Len B

I was referred here by when I posted the question below

to the outlook.interop group. At Ken's suggestion I added a namespace

and performed a logon to it. That produced the same error description

but different error numbers. I am not familiar with the Outlook object

model but I guess I can expect that I'll need to be soon.

--------
I am trying to use MS Access 2003 to automate the sending of a number

of messages. I have the following code (stolen from MS KB161088 and

modified) which fails with error code -1594867707 (a0f04005) when

executing the .Send method. Googling the hex error gave zero results

and Googling the decimal error yielded runtime errors with differing

numbers, none of which were relevant.

Clicking on Help from the error dialog brings up help on error

440 - Automation.

The text of the error is: Outlook does not recognize one or more

names. Googling this yields a Microsoft support page suggesting

that the address book is corrupt. I can successfully send e-mail

directly from OL and the sole test recipient is my own email

address which does appear in my address book.

Dim objOut As Outlook.Application

Dim objOutMsg As Outlook.MailItem

Dim oNS as Outlook.NameSpace 'suggested by

Dim strRecipient As String, strSubject As String

Dim strBody As String

Dim blnDisplayMsg As Boolean

blnDisplayMsg = Me.chkDisplay 'do we display the email first

Set objOut = CreateObject("Outlook.Application") 'Create Outlook session

Set oNS = objOut.GetNamespace("MAPI") 'suggested by

oNS.Logon "","", False, False 'suggested by

> ...

Set objOutMsg = objOut.CreateItem(olMailItem) 'create Outlook message

With objOutMsg

> recipients.Add strRecipient 'To field

> subject = strSubject 'Subject field

> body = strBody 'Body field

If blnDisplayMsg Then 'display before sending

> Display

Else 'just send it

> Save

===> .Send

End If

End With 'done with this message

'erase just sent msg from memory

Set objOutMsg = Nothing

If I send the logic through the .Display method instead, OL fires

and the fields are correctly populated. Clicking on the [Send]

button has the expected result. However, requiring the user to

click send on multiple messages somewhat defeats the purpose.

I hope I am asking in the right forum.

Where to from here?

--------
I am developing on OL2003 connected to POP3 at my ISP.

Target system is OL2003 with Exchange Server [SBS 2003].

I am running into the "object model guard" issue but Ken gave me

a link so that I can look into it.

I should mention that it is unlikely that all recipients will

be listed in the sender's address book and probably undesirable

that they be added.

Len

________________

remove nothing for valid email address.
 
K

Ken Slovak - [MVP - Outlook]

I believe I also suggested declaring and instantiating a Recipient object

from the return value of the Recipients.Add() function and then calling the

Resolve() method on that recipient.

Dim oRecip As Outlook.Recipient

With objOutMsg

Set oRecip = .Recipients.Add(strRecipient)

oRecip.Resolve

If oRecip.Resolved Then

> Send

Else

MsgBox "recip not resolved"

End If

".Len B" <gonehome@internode0.on0.net> wrote in message

news:uxdZ0t9wKHA.2436@TK2MSFTNGP04.phx.gbl...
> I was referred here by when I posted the question below
> to the outlook.interop group. At Ken's suggestion I added a namespace
> and performed a logon to it. That produced the same error description
> but different error numbers. I am not familiar with the Outlook object
> model but I guess I can expect that I'll need to be soon.

> --------> I am trying to use MS Access 2003 to automate the sending of a number
> of messages. I have the following code (stolen from MS KB161088 and
> modified) which fails with error code -1594867707 (a0f04005) when
> executing the .Send method. Googling the hex error gave zero results
> and Googling the decimal error yielded runtime errors with differing
> numbers, none of which were relevant.

> Clicking on Help from the error dialog brings up help on error
> 440 - Automation.

> The text of the error is: Outlook does not recognize one or more
> names. Googling this yields a Microsoft support page suggesting
> that the address book is corrupt. I can successfully send e-mail
> directly from OL and the sole test recipient is my own email
> address which does appear in my address book.

> Dim objOut As Outlook.Application
> Dim objOutMsg As Outlook.MailItem
> Dim oNS as Outlook.NameSpace 'suggested by

> Dim strRecipient As String, strSubject As String
> Dim strBody As String
> Dim blnDisplayMsg As Boolean

> blnDisplayMsg = Me.chkDisplay 'do we display the email first
> Set objOut = CreateObject("Outlook.Application") 'Create Outlook session
> Set oNS = objOut.GetNamespace("MAPI") 'suggested by

> oNS.Logon "","", False, False 'suggested by

> ...
> Set objOutMsg = objOut.CreateItem(olMailItem) 'create Outlook message
> With objOutMsg
> .recipients.Add strRecipient 'To field
> .subject = strSubject 'Subject field
> .body = strBody 'Body field
> If blnDisplayMsg Then 'display before sending
> .Display
> Else 'just send it
> .Save
> ===> .Send
> End If
> End With 'done with this message
> 'erase just sent msg from memory
> Set objOutMsg = Nothing

> If I send the logic through the .Display method instead, OL fires
> and the fields are correctly populated. Clicking on the [Send]
> button has the expected result. However, requiring the user to
> click send on multiple messages somewhat defeats the purpose.

> I hope I am asking in the right forum.
> Where to from here?
> --------> I am developing on OL2003 connected to POP3 at my ISP.
> Target system is OL2003 with Exchange Server [SBS 2003].

> I am running into the "object model guard" issue but Ken gave me
> a link so that I can look into it.

> I should mention that it is unlikely that all recipients will
> be listed in the sender's address book and probably undesirable
> that they be added.

> > Len
> ________________
> remove nothing for valid email address.

>
 
L

.Len B

Thanks Ken,

My Internet connection went down there for a while.

The app is now able to send ok.

Thanks again for your help.

Len

________________

remove nothing for valid email address.
<kenslovak@mvps.org> wrote in message

news:eaEqq9DxKHA.3896@TK2MSFTNGP02.phx.gbl...

|I believe I also suggested declaring and instantiating a Recipient

object

| from the return value of the Recipients.Add() function and then calling

the

| Resolve() method on that recipient.

|

| Dim oRecip As Outlook.Recipient

| With objOutMsg

| Set oRecip = .Recipients.Add(strRecipient)

| oRecip.Resolve

| If oRecip.Resolved Then

| .Send

| Else

| MsgBox "recip not resolved"

| End If

|

|

|

|

|

|

|

|

|

|

| ".Len B" <gonehome@internode0.on0.net> wrote in message

| news:uxdZ0t9wKHA.2436@TK2MSFTNGP04.phx.gbl...

| >I was referred here by when I posted the question below

| > to the outlook.interop group. At Ken's suggestion I added a namespace

| > and performed a logon to it. That produced the same error description

| > but different error numbers. I am not familiar with the Outlook

object

| > model but I guess I can expect that I'll need to be soon.

|

| > --------
| > I am trying to use MS Access 2003 to automate the sending of a number

| > of messages. I have the following code (stolen from MS KB161088 and

| > modified) which fails with error code -1594867707 (a0f04005) when

| > executing the .Send method. Googling the hex error gave zero results

| > and Googling the decimal error yielded runtime errors with differing

| > numbers, none of which were relevant.

|

| > Clicking on Help from the error dialog brings up help on error

| > 440 - Automation.

|

| > The text of the error is: Outlook does not recognize one or more

| > names. Googling this yields a Microsoft support page suggesting

| > that the address book is corrupt. I can successfully send e-mail

| > directly from OL and the sole test recipient is my own email

| > address which does appear in my address book.

|

| > Dim objOut As Outlook.Application

| > Dim objOutMsg As Outlook.MailItem

| > Dim oNS as Outlook.NameSpace 'suggested by

| > Dim strRecipient As String, strSubject As String

| > Dim strBody As String

| > Dim blnDisplayMsg As Boolean

|

| > blnDisplayMsg = Me.chkDisplay 'do we display the email first

| > Set objOut = CreateObject("Outlook.Application") 'Create Outlook

session

| > Set oNS = objOut.GetNamespace("MAPI") 'suggested by

| > oNS.Logon "","", False, False 'suggested by

| > ...

| > Set objOutMsg = objOut.CreateItem(olMailItem) 'create Outlook

message

| > With objOutMsg

| > .recipients.Add strRecipient 'To field

| > .subject = strSubject 'Subject field

| > .body = strBody 'Body field

| > If blnDisplayMsg Then 'display before sending

| > .Display

| > Else 'just send it

| > .Save

| > ===> .Send

| > End If

| > End With 'done with this message

| > 'erase just sent msg from memory

| > Set objOutMsg = Nothing

|

| > If I send the logic through the .Display method instead, OL fires

| > and the fields are correctly populated. Clicking on the [Send]

| > button has the expected result. However, requiring the user to

| > click send on multiple messages somewhat defeats the purpose.

|

| > I hope I am asking in the right forum.

| > Where to from here?

| > --------
| > I am developing on OL2003 connected to POP3 at my ISP.

| > Target system is OL2003 with Exchange Server [SBS 2003].

|

| > I am running into the "object model guard" issue but Ken gave me

| > a link so that I can look into it.

|

| > I should mention that it is unlikely that all recipients will

| > be listed in the sender's address book and probably undesirable

| > that they be added.

|

| >

| > Len

| > ________________

| > remove nothing for valid email address.

|

|

|
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
C Copy email to excel runtime error 5020 Using Outlook 5
D Need Help with Script. Keep getting Runtime Error 438 BCM (Business Contact Manager) 4
L Cannot update Location field in Contacts - Runtime Error 438 Using Outlook 0
V Custom UI Runtime Error in Business Contact Manager for Outlook (2013) BCM (Business Contact Manager) 6
N runtime error while loading of outlook 2003 plugin Outlook VBA and Custom Forms 1
S Reading mailitem after mail is send give runtime error. Outlook VBA and Custom Forms 1
N Changing the 'Mark item as read when selection changes' at runtime Outlook VBA and Custom Forms 1
J Common runtime language? BCM (Business Contact Manager) 1
M How to change the Title of a form region at runtime? Outlook VBA and Custom Forms 3
B Re: BCM failed to initialize the common language runtime BCM (Business Contact Manager) 4
Cathy Rhone Mail merge error message Using Outlook 2
U Outlook 2019 VBA run-time error 424 Outlook VBA and Custom Forms 2
V Outlook error 500 Using Outlook 2
O Comma Separated Values.ADR and A file error has occurred in the translator Using Outlook 6
D We're sorry but outlook has run into an error Using Outlook 6
D Outlook 2016 Outlook Error Msg "The operation cannot be performed ..." How to Stop it Using Outlook 4
P Outlook 2013 All imported Mail Rules in error when imported into new profile Using Outlook 5
H Outlook 2019 Certificate error Using Outlook 2
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 2
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
A Unable to save recurring Meeting to Documents folder due to error Using Outlook 2
M Compile error: User-defined type not defined Outlook VBA and Custom Forms 0
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
M ERROR: None of your email accounts could send to this recipient Using Outlook 2
J OLADD.FAE Error When Exporting Contacts Using Outlook 6
C Send/receive error 80040119 Using Outlook 2
W error with the permission for the file Outlook VBA and Custom Forms 0
L Outlook 2019 MAC sync error after working for 4 hours Using Outlook 1
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
M error code 0x8DE00006 Using Outlook 1
M Desktop Version Of Outlook Generating Error Using Outlook 4
M Send/Receive error 0x800CCC0F Using Outlook 0
T Outlook 2016 CSV Translator Import Error Using Outlook 6
ManaarZakaria I'm afraid of this issue, cause of strange error Exchange Server Administration 2
P Suppress dialog box on email check error? Using Outlook 5
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
avant-guvnor Outlook.Application now produces error Outlook VBA and Custom Forms 5
P Run Time Error 91 when linking contact to task in VBA Outlook VBA and Custom Forms 1
N Error 0x80090326 when trying to setup IMAP account on Outlook.com Using Outlook.com accounts in Outlook 1
N Saving And Deleting Outlook Attachments with Unknown Error Message Outlook VBA and Custom Forms 1
Dennis Gaudenzi Your setup couldn't be started because of an unexpected error (mapi 0x80040604) Using Outlook 14
M Outlook 2013 fails to start -- missing WindowsCodecs.dll error Using Outlook 3
Steshelter ICloud Unexpected Error Using Outlook 5
Rupert Dragwater "there was an error reading this theme" Using Outlook 3
A Error: The name cannot be matched to a name in the address list Using Outlook.com accounts in Outlook 0

Similar threads

Top