Hi folks can someone help with a little problem about sending emails from vb6 via outlook etc. the following code is the main extract from my code. The process works ok providing OK/YES is selected at each of the dialogs
1. 'profile not valid/enter valid name' (OK and use default)
2. a program is trying to send emails (OK these)
etc etc
and proceeding through BUT if the user selects the CANCEL button at any time i get login failure error(s) code 32003
can someone please show me how to trap this error?
VB Code:
Dim objUser As COO.clsUser Dim strTemp As String Dim strSubFuncName As String Dim strEmailAttached As String Dim strEmailGuid As String strSubFuncName = "frmMain:MailSession" On Error GoTo ErrHandler MailSession = False strEmailAttached = ComputerName Set objUser = New COO.clsUser objUser.GetData MAPISession.NewSession = True MAPISession.UserName = GetCurrentUser MAPISession.Password = "" MAPISession.LogonUI = True MAPISession.SignOn MAPIMessages.SessionID = MAPISession.SessionID MAPIMessages.Compose MAPIMessages.MsgIndex = -1 MAPIMessages.RecipDisplayName = objUser.RecipientName MAPIMessages.RecipAddress = objUser.RecipientAddress MAPIMessages.AddressResolveUI = False MAPIMessages.ResolveName strEmailGuid = mstrGUID 'the companyname and companycode fields are the form's static fields strTemp = "EORDER: " & txtCompanyName.Text & " (" & txtCompanyCode.Text & ") ID: " & strEmailGuid MAPIMessages.MsgSubject = strTemp MAPIMessages.MsgNoteText = "Order" MAPIMessages.AttachmentPathName = App.Path & "\" & strEmailAttached & ".xml" MAPIMessages.send False MailSession = True Exit Function ErrHandler: ErrorHandling strSubFuncName, Err.Number, Err.Description, Err.Source MailSession = False End Function
Edit: Added [vbcode][/vbcode] tags for clairty. - Hack




Reply With Quote