Author |
|
Richard Lindsay Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 11 September 2005 at 6:58am | IP Logged
|
|
|
Hi all,
Sorry I'm a newbie to MailBee, I need to know how to enable events in MailBee IMAP4.
I've used the following examole be keep getting the error message : "User-Defined type not defined" on the line "Public WithEvents objIMAP4 As MailBee.IMAP4"
Here is the code, I know that there is no event code in here, I just wanted to keep it simple for you at this stage.
Option Compare Database
Option Explicit
Dim objMsg
Public WithEvents objIMAP4 As MailBee.IMAP4
Private Sub cmdConnect_Click()
' Create IMAP4 object
Set objIMAP4 = CreateObject("MailBee.IMAP4")
' Unlock IMAP4 object
objIMAP4.LicenseKey = "our licence key"
' Set IMAP4 server name
objIMAP4.ServerName = "our sever name"
' Set user credentials
objIMAP4.UserName = "our username"
objIMAP4.Password = "our password"
' Connect to the server and
' log in email account
If objIMAP4.Connect Then
MsgBox "Connected successfully"
' Close the connection
objIMAP4.Disconnect
Else
' Display error information
MsgBox "Error #" & objIMAP4.ErrCode
MsgBox "Server response: " & objIMAP4.ServerResponse
End If
End Sub
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 11 September 2005 at 11:04am | IP Logged
|
|
|
You should reference MailBee type library in your project in order to be able to import MailBee types (such as IMAP4) in your app.
You can do this by checking MailBee Objects type library on in Tools/References dialog when you're in "edit code" mode (VBA editor is active).
Also, when MailBee types are declared via References, it's better to instantiate objects using New rather than CreateObject:
Set objIMAP4 = New MailBee.IMAP4
Regards,
Alex
|
Back to Top |
|
|