Search The ForumSearch   RegisterRegister  LoginLogin

MailBee IMAP4

 AfterLogic Forum : MailBee IMAP4
Subject Topic: Events in Access 97 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Richard Lindsay
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 11 September 2005 at 6:58am | IP Logged Quote Richard Lindsay

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 View Richard Lindsay's Profile Search for other posts by Richard Lindsay
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 11 September 2005 at 11:04am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide