Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. vb and vba

vb and vba

Scheduled Pinned Locked Moved Visual Basic
helpsysadminquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cristian_Dior
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • C Cristian_Dior

      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

      P Offline
      P Offline
      pxw
      wrote on last edited by
      #2

      Add a reference to the CDO com object and use CDO calls to exchange server. There are several varieties of CDO calls so pick the one that suits your needs.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups