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.
 
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.

>
 
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
L Error when exporting Sent Mail to Excel Outlook VBA and Custom Forms 6
G Outlook 365 My iCloud Outlook doesn’t work after reinstalling Microsoft365 on Windows 10 PC – now I get error message on contacts and calendar Using Outlook 1
V Outlook Error The Attempted operation Failed. An Object Could Not be found Outlook VBA and Custom Forms 0
S macro error 4605 Outlook VBA and Custom Forms 0
humility36 Cannot move emails to archive - 440 error Outlook VBA and Custom Forms 1
D.Moore Strange VBA error Outlook VBA and Custom Forms 4
T Event Error on non existent Event. Using Outlook 2
P now on office 365 but getting error messages about missing Outlook 2013 cache folders Using Outlook 2
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
A Links in email getting error message about group policy Using Outlook 4
Aussie Outlook 365 Rule runs manually but returns the error code "an unexpected error has occurred" when incoming mail arrives Using Outlook 1
Cathy Rhone Mail merge error message Using Outlook 1
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

Similar threads

Back
Top