Results 1 to 32 of 32

Thread: how to make lable of address and how to connect vb to outlook for send email

Hybrid View

  1. #1
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: how to make lable of address and how to connect vb to outlook for send email

    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
    CS

  2. #2
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Re: how to make lable of address and how to connect vb to outlook for send email

    Do you think it is possible to modify the code above creating an Outlook object through (late binding) code instead of making a reference to the Outlook object? This way the app would not require an installation to run and could even be used in a LAN by simply placing the executable in a shared folder.

    Can anybody help to make the necessary modifications?

    TIA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width