Results 1 to 10 of 10

Macro to Send Email from different account

Threaded View

  1. #1
    Registered User
    Join Date
    03-04-2015
    Location
    MT
    MS-Off Ver
    2013
    Posts
    9

    Exclamation Macro to Send Email from different account

    Hello,

    I have Office 2013, and I am trying to write a macro to send an email from a certain account, but my Email_Send_From doesnt seem to be working. The email sends to who I want it to, and says what I want it to, but it is using the wrong email to send from.


    Any help? I have several emails setup on my outlook. I want it to send from my gmail account. I have it setup with imap.

    Thank you for the help.

    Sub Email_Tenant_1934()
    Dim Email_Subject, Email_Send_From, Email_Send_To, _
    Email_Cc, Email_Bcc, Email_Body As String
    Dim Mail_Object, Mail_Single As Variant
    Email_Subject = "Hello " & ActiveSheet.Range("B3")
    Email_Send_From = "XXXX@gmail.com"
    Email_Send_To = ActiveSheet.Range("B5")
    Email_Cc = ""
    Email_Bcc = ""
    Email_Body = "It works!"
    On Error GoTo debugs
    Set Mail_Object = CreateObject("Outlook.Application")
    Set Mail_Single = Mail_Object.CreateItem(0)
    With Mail_Single
    .Subject = Email_Subject
    .To = Email_Send_To
    .cc = Email_Cc
    .BCC = Email_Bcc
    .Body = Email_Body
    .send
    
    MsgBox "Mail Has Been Sent"
    
    End With
    debugs:
    If Err.Description <> "" Then MsgBox Err.Description
    End Sub
    Last edited by automafia; 03-04-2015 at 04:57 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Send email from non-default outlook account via VBA
    By moonmanhk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2014, 10:44 AM
  2. Excel Email Macro VBA - How to send an email once all required fields have been fille
    By wallacm2009 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2012, 10:51 AM
  3. Replies: 6
    Last Post: 12-02-2011, 02:14 PM
  4. Send data from Excel in email from specific email account
    By eriknokc in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-05-2007, 05:02 PM
  5. Email Macro using IMAP account
    By billy2willy in forum Excel General
    Replies: 0
    Last Post: 08-17-2005, 12:59 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1