www.pudn.com > 20063518740652.zip > MODULE32.BAS
'
' SEE32.BAS [SEE4VB Ver 2.0; VBA]
'
' For EXCEL97, ACCESS97, and WORD97.
'
' Create a button in your VBA application. The default name will be "CommandButton1", and the VBA code
' will contain code that looks like
'
' Private Sub CommandButton1_Click()
'
' End Sub
'
' Replace the generated code with this module, then edit this module as noted below under
' "IMPORTANT". You are now ready to email from your VBA application.
Private Declare Function seeClose Lib "SEE32.DLL" () As Long
Private Declare Function seeDebug Lib "SEE32.DLL" (ByVal Index As Long, ByVal Buffer As String, ByVal BufLen As Long) As Long
Private Declare Function seeDeleteEmail Lib "SEE32.DLL" (ByVal MsgNbr As Long) As Long
Private Declare Function seeDriver Lib "SEE32.DLL" () As Long
Private Declare Function seeErrorText Lib "SEE32.DLL" (ByVal Code As Long, ByVal Buffer As String, ByVal BufLen As Long) As Long
Private Declare Function seeExtractText Lib "SEE32.DLL" (ByVal Src As String, ByVal Text As String, ByVal Buffer As String, ByVal BufLen As Long) As Long
Private Declare Function seeGetEmailCount Lib "SEE32.DLL" () As Long
Private Declare Function seeGetEmailFile Lib "SEE32.DLL" (ByVal MsgNbr As Long, ByVal FileName As String, ByVal EmailDir As String, ByVal AttachDir As String) As Long
Private Declare Function seeGetEmailLines Lib "SEE32.DLL" (ByVal MsgNbr As Long, ByVal Lines As Long, ByVal Buffer As String, ByVal BufLen As Long) As Long
Private Declare Function seeGetEmailSize Lib "SEE32.DLL" (ByVal MsgNbr As Long) As Long
Private Declare Function seeIntegerParam Lib "SEE32.DLL" (ByVal Index As Long, ByVal Value As Long) As Long
Private Declare Function seePop3Connect Lib "SEE32.DLL" (ByVal Server As String, ByVal User As String, ByVal Password As String) As Long
Private Declare Function seeSendEmail Lib "SEE32.DLL" (ByVal Rcpt As String, ByVal CC As String, ByVal BCC As String, ByVal Subj As String, ByVal Msg As String, ByVal Attach As String) As Long
Private Declare Function seeSmtpConnect Lib "SEE32.DLL" (ByVal Server As String, ByVal From As String, ByVal Reply As String) As Long
Private Declare Function seeStatistics Lib "SEE32.DLL" (ByVal Index As Long) As Long
Private Declare Function seeStringParam Lib "SEE32.DLL" (ByVal Index As Long, ByVal Value As String) As Long
Private Declare Function seeVerifyFormat Lib "SEE32.DLL" (ByVal EmailAddr As String) As Long
Private Declare Function seeVerifyUser Lib "SEE32.DLL" (ByVal EmailAddr As String) As Long
Private Declare Function seeEncodeBuffer Lib "SEE32.DLL" (ByVal ClearBuf As String, ByVal CodedBuf As String, ByVal BufLen As Long) As Long
Private Declare Function seeDecodeBuffer Lib "SEE32.DLL" (ByVal CodedBuf As String, ByVal ClearBuf As String, ByVal BufLen As Long) As Long
Private Const SEE_MIN_RESPONSE_WAIT = 1
Private Const SEE_MAX_RESPONSE_WAIT = 2
Private Const SEE_CONNECT_WAIT = 3
Private Const SEE_MIN_LINE_WAIT = 5
Private Const SEE_MAX_LINE_WAIT = 6
Private Const SEE_QUOTED_PRINTABLE = 8
Private Const SEE_AUTO_CALL_DRIVER = 9
Private Const SEE_LOG_FILE = 20
Private Const SEE_GET_COUNTER = 2
Private Const SEE_GET_RESPONSE = 3
Private Const SEE_GET_SOCK_ERROR = 4
Private Const SEE_GET_MESSAGE_BYTES_READ = 10
Private Const SEE_GET_ATTACH_BYTES_READ = 11
Private Const SEE_GET_TOTAL_BYTES_READ = 12
Private Const SEE_GET_MESSAGE_BYTES_SENT = 13
Private Const SEE_GET_ATTACH_BYTES_SENT = 14
Private Const SEE_GET_TOTAL_BYTES_SENT = 15
Private Const SEE_GET_VERSION = 16
Private Const SEE_GET_MSG_COUNT = 17
Private Const SEE_GET_MSG_SIZE = 18
Private Const SEE_GET_BUFFER_COUNT = 19
Private Const SEE_GET_CONNECT_STATUS = 20
Private Const SEE_GET_REGISTRATION = 21
Private Const SEE_GET_ATTACH_COUNT = 22
Private Const SEE_GET_LAST_RESPONSE = 23
Private Const SEE_GET_VERIFY_STATUS = 24
Private Const SEE_GET_SERVER_IP = 25
Private Const SEE_GET_BUILD = 26
Private Sub ShowError(Code As Long)
Dim Buffer As String * 81
Code = seeErrorText(Code, Buffer, 80)
MsgBox Buffer
End Sub
'
' IMPORTANT: You must replace "smtp_host_home" with the name of your SMTP server.
' Similarly for "your_email_address", and "receipients_email_address"
' before running.
'
Private Sub CommandButton1_Click()
Dim Code As Long
MsgBox "Connecting..."
Code = seeSmtpConnect("smtp_host_name", "your_email_address", "")
If Code < 0 Then
Call ShowError(Code)
Exit Sub
End If
MsgBox "Sending Email..."
Code = seeSendEmail("receipients_email_address", "", "", "Email from VBA", "Hello from VBA", "")
If Code < 0 Then
Call ShowError(Code)
Exit Sub
End If
Code = seeClose()
End Sub