vb and vba
-
does someone know if its possible to send email in vba using smtp and winsock? i got a code which works in vb.Using the code in vba seems to be possible and also the refereces are in vba available but i always get the same message "objectvariable or with-blockvariable not set" what does it mean? here is my complete code, hope someone can help Option Explicit ' ---------------------------------------------------------------------------- ' ' EVENTS ' ' ---------------------------------------------------------------------------- Public Event Connected(ByVal Host As String, ByVal Port As Long) Public Event ReceivedData(ByVal Data As String) Public Event SentData(ByVal Data As String) Public Event MailCompleted() Public Event Error(ByVal Error As String) ' ------------------------------------------------------------------------------ ' ' PROPERTY VARIABLES ' ' ------------------------------------------------------------------------------ Dim m_Server As String ' mail server host Dim m_Port As String ' mail server port Dim m_MailFrom As String ' from address Dim m_MailTo As String ' to address Dim m_BCC As String ' blind carbon copy addresses Dim m_CCC As String ' carbon copy addresses Dim m_Subject As String ' email subject Dim m_NameFrom As String ' from name Dim m_NameTo As String ' to name Dim m_Body As String ' email body Dim m_Log As String ' log of transaction Dim Sock As Winsock ' private state variables Dim LastResponse As String ' ------------------------------------------------------------------------------ ' ' PUBLIC PROPERTIES ' ' ------------------------------------------------------------------------------ Public Property Get Server() As String Server = m_Server End Property Public Property Let Server(ByVal Data As String) m_Server = Data End Property Public Property Get Port() As String Port = m_Port End Property Public Property Let Port(ByVal Data As String) m_Port = Data End Property Public Property Get MailFrom() As String MailFrom = m_MailFrom End Property Public Property Let MailFrom(ByVal Data As String) m_MailFrom = Data End Property Public Property Get MailTo() As String MailTo = m_MailTo End Property Public Property Let MailTo(ByVal Data As String) m_MailTo = Data End Property
-
does someone know if its possible to send email in vba using smtp and winsock? i got a code which works in vb.Using the code in vba seems to be possible and also the refereces are in vba available but i always get the same message "objectvariable or with-blockvariable not set" what does it mean? here is my complete code, hope someone can help Option Explicit ' ---------------------------------------------------------------------------- ' ' EVENTS ' ' ---------------------------------------------------------------------------- Public Event Connected(ByVal Host As String, ByVal Port As Long) Public Event ReceivedData(ByVal Data As String) Public Event SentData(ByVal Data As String) Public Event MailCompleted() Public Event Error(ByVal Error As String) ' ------------------------------------------------------------------------------ ' ' PROPERTY VARIABLES ' ' ------------------------------------------------------------------------------ Dim m_Server As String ' mail server host Dim m_Port As String ' mail server port Dim m_MailFrom As String ' from address Dim m_MailTo As String ' to address Dim m_BCC As String ' blind carbon copy addresses Dim m_CCC As String ' carbon copy addresses Dim m_Subject As String ' email subject Dim m_NameFrom As String ' from name Dim m_NameTo As String ' to name Dim m_Body As String ' email body Dim m_Log As String ' log of transaction Dim Sock As Winsock ' private state variables Dim LastResponse As String ' ------------------------------------------------------------------------------ ' ' PUBLIC PROPERTIES ' ' ------------------------------------------------------------------------------ Public Property Get Server() As String Server = m_Server End Property Public Property Let Server(ByVal Data As String) m_Server = Data End Property Public Property Get Port() As String Port = m_Port End Property Public Property Let Port(ByVal Data As String) m_Port = Data End Property Public Property Get MailFrom() As String MailFrom = m_MailFrom End Property Public Property Let MailFrom(ByVal Data As String) m_MailFrom = Data End Property Public Property Get MailTo() As String MailTo = m_MailTo End Property Public Property Let MailTo(ByVal Data As String) m_MailTo = Data End Property