Results 1 to 10 of 10

Thread: Email worksheet as TXT or as CSV

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Tutor jamescol's Avatar
    Joined
    May 2004
    Location
    Charlotte, NC
    Posts
    251
    Location
    Anne,
    This sample is (so far) untested, but should enable you to send a MAPI email via Groupwise as long as GW is the default mail program. Actually, this sample will simply send a message via the default MAPI email client - really doesn't matter which one is being used. Good to keep in your back pocket.

    James

    Sub SendMAPIMail()
       Dim objSession As Object
       Dim objMessage As Object
       Dim objRecipient As Object
       Dim strSubject as String  'From Excel data
       Dim strMessageBody as String  'From Excel data
       Dim strRecipient as String  'From Excel
    ' Create the Session Object
    Set objSession = CreateObject("MAPI.Session")
    ' Log on using the session object
    objSession.Logon , , False, False
    ' Add a new message to the OutBox
    Set objMessage = objSession.Outbox.Messages.Add
    'Set the mail item properties
    objMessage.Subject = strSubject
    objMessage.Text = strMessageBody
    'Add a recipient object to the objMessage.Recipients collection
    Set objRecipient = objMessage.Recipients.Add
    ' Set the properties of the recipient object
    objRecipient.Name = strRecipient
    objRecipient.Resolve
    'Send the message
    objMessage.Send showDialog:=False
    ' Log off using the session object
    objSession.Logoff
    'Cleanup
    Set objSession = Nothing
    Set objMessage = Nothing
    Set objRecipient = Nothing
    Last edited by Aussiebear; 03-29-2023 at 03:48 PM. Reason: Adjusted code tags
    "All that's necessary for evil to triumph is for good men to do nothing."

Posting Permissions

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