Run-time error 80070057 on send email from Outlook 2000

S

Sivas

Hi all...

I'm getting a run-time error when I try to send an email from my VB 6
app on an Win NT server. It works perfectly on Win XP. Any idea why?

==================================

'Create an Outlook object
Dim Outlook As Outlook.Application
Set Outlook = CreateObject("Outlook.Application")

'Create e new message
Dim Message As Outlook.MailItem
Const olMailItem = 0

Dim oRecipient As Outlook.Recipient

Set Message = Outlook.CreateItem(olMailItem)

With Message
'You can display the message To debug And see state
'.Display

.Subject = "WARNING FROM..."
.Body = "The application has stopped..."

'Set destination email address
.Recipients.Add("(e-mail address removed)")

'Send the message
.Send

End With

==========================

Thanks,
Sivas
 
K

Ken Slovak - [MVP - Outlook]

Where are you getting the error? That error is mostly a MAPI or CDO error,
not an OOM error, it maps to MAPI_E_INVALID_PARAMETER.

Is Outlook installed locally on the server?
 
S

Sivas Sivaskanthan

I was getting it on the "message.send" and Oulook was locally installed
on the server.

==================

With Message




'Problem here
.Send

End With

=================

...but happy to say that I have fixed the bug. The problem seemed to be
because I hadn't forced a .resolve after the .Recipients.Add("")
command. It worked after I included it. Funny, as I would have thought
that as long as the email was correct, it shouldn't matter.

Here's the code that worked:

With Message
'You can display the message To debug And see state
'.Display

.Subject = "WARNING..."
.Body = "The..."

'Set destination email address
.Recipients.Add("").Resolve

'Send the message
.Send

End With

============================

Thanks a lot for your help Ken.

Sivas
 
K

Ken Slovak - [MVP - Outlook]

You always need to explicitly resolve any recipient, especially when using
Exchange.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top