Error 0 with Redemption...huh?

D

Dewey

Hi
I have a COM add-in I've been developing for a while that was working
great...up until I changed some things and lost track of all the changes.
Unfortunately, I'm not using version control, and I don't remember all of the
things I did. I'm not getting any compiler errors, but when I go to send an
email with the add-in, which uses Redemption in Outlook, I get an error with
a code of 0, trapped by the error handler in my code. What is an error with
a code of 0? Doesn't that mean "no error?" For some reason, there's a
problem there, but I'm not sure why.

The only other odd thing is that I have an "Imports MSMAPI" statement at
the top of my code that the compiler reports is now now able to be
found...I'm not sure if the two issues are related though.


Here's my code. Thanks for any help!:



Public Sub SendMail(ByVal mode As String)


'create a redemption session and log on
Dim Session As Redemption.RDOSession
Session = CreateObject("Redemption.RDOSession")
Session.Logon()


Dim omsg1 As Outlook.MailItem
Dim msg1 As New Redemption.SafeMailItem


'Create the object needed for the message:
omsg1 = m_olApp.CreateItem(OlItemType.olMailItem)

omsg1.BodyFormat = OlBodyFormat.olFormatHTML
omsg1.HTMLBody = pre_boarding1_body_html
omsg1.Subject = "Welcome!"

'Assign the message's soul to Redemption
msg1.Item = omsg1


With msg1
.Recipients.Add("(e-mail address removed)")

.Send()
msg1 = Nothing
omsg1 = Nothing
End With


'If CDate(txtStartDate.Text) > Now Then
m_olMailItem.DeferredDeliveryTime = CDate(txtStartDate.Text)


Return

Mailing_Error:
MsgBox("Error " & Err.Number & " while sending mail" & vbCrLf &
Err.Source)

End Sub
 
D

Dmitry Streblechenko

Which line exactly returns an error?
What does RDOSession do? Why do you create that object?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dewey

That's the thing...I wasn't even sure which line is creating the error..
BUT...something you said helped me see what's happening:

There was no error. The email wasn't getting sent, however, so it made me
think there was. In reality, I was passing an incorrect argument to the
subroutine. The first If statement checked that input, and since it wasn't
the true case the If was looking for, it made execution jump the entire
block, and end at the error handler. Normally, the sub would've been exited
at the bottom of the If block, but since it was never entered, the error
routine was run sdtraight away, even with no error.

Thanks for your help. This actually helps me to trap another case that I
didn't account for originally. Sorry for the trouble.

-Josh
 

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