Results 1 to 2 of 2

Thread: MSMAPI32.OCX Download

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    ohio
    Posts
    3

    Angry

    I wrote a program that I would like to request information from the user and email it to me. Is this possible using MSMapi32.ocx? I don't have this on my machine, can I download it?

    Ben
    Yeeeeeeehaaaaaaw

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    the .OCX is unlikely what you want.

    Add a reference to MS Outlook 9.0 Object Library (you need Outlook 2000).

    Try this code (it comes from the Chapter 5 of the MS Office Visual Basic Programmers Guide).

    Function CreateMail(astrRecip As Variant, _
    strSubject As String, _
    strMessage As String, _
    Optional astrAttachments As Variant) As Boolean
    ' This procedure illustrates how to create a new mail message
    ' and use the information passed as arguments to set message
    ' properties for the subject, text (Body property), attachments,
    ' and recipients.

    Dim objNewMail As Outlook.MailItem
    Dim varRecip As Variant
    Dim varAttach As Variant
    Dim blnResolveSuccess As Boolean

    On Error GoTo CreateMail_Err

    ' Use the InitializeOutlook procedure to initialize global
    ' Application and NameSpace object variables, if necessary.
    If golApp Is Nothing Then
    If InitializeOutlook = False Then
    MsgBox "Unable to initialize Outlook Application " _
    & "or NameSpace object variables!"
    Exit Function
    End If
    End If

    Set golApp = New Outlook.Application
    Set objNewMail = golApp.CreateItem(olMailItem)
    With objNewMail
    For Each varRecip In astrRecip
    .Recipients.Add varRecip
    Next varRecip
    blnResolveSuccess = .Recipients.ResolveAll
    For Each varAttach In astrAttachments
    .Attachments.Add varAttach
    Next varAttach
    .Subject = strSubject
    .Body = strMessage
    If blnResolveSuccess Then
    .Send
    Else
    MsgBox "Unable to resolve all recipients. Please check " _
    & "the names."
    .Display
    End If
    End With

    CreateMail = True

    CreateMail_End:
    Exit Function
    CreateMail_Err:
    CreateMail = False
    Resume CreateMail_End
    End Function

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