VB Code:
  1. 'In your project go to References and click Microsoft Outlook 8.0/11.0 Object Library.
  2.  
  3. ' make sure a reference to the Outlook object is set
  4. ' place the following code in a command button click event
  5. Private Sub cmdSendMail_Click()
  6.     Dim objOutlook As Outlook.Application
  7.     Dim objMailItem As Outlook.MailItem
  8.     Set objOutlook = New Outlook.Application
  9.     Set objMailItem = objOutlook.CreateItem(olMailItem)
  10.     With objMailItem.To = "ToAddress"  'recipient's address
  11.         .Subject = "subject"  'subject box content
  12.         .Body = "email message"  ' message goes here
  13.         .Attachment = "c:\path\file.txt"    ' attach any files here
  14.         .Send
  15.     End With
  16.     Set objMailItem = Nothing
  17.     Set objOutlook = Nothing
  18. End Sub