Results 1 to 3 of 3

Sending Emails VBA - Specify Who From

Threaded View

  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Sending Emails VBA - Specify Who From

    Hello

    I have a spreadsheet where it looks up the email address of someone based on the name and then sends an email to that person. A lot of people will be using this spreadsheet but we want it to look like it comes from the same person each time

    My code is

    Sub Mail_Selection_Range_Outlook_Body()
       Dim start As Integer
       start = Application.CountIf(Worksheets("Calls").Range("A1:A1005"), "*") + 4
        Dim OutApp As Object
        Dim OutMail As Object
        
        Call GetAddresses
        
        With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With
        
        Set OutApp = CreateObject("Outlook.Application")
        OutApp.Session.Logon
        Set OutMail = OutApp.CreateItem(0)
        On Error Resume Next
        
        With OutMail
            .To = Cells(start, 7)
            .Subject = "Subject"
            .Body = Cells(start, 6)
            .Display 'or use .Display
        End With
        On Error GoTo 0
         
        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With
         
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub
    Is there a way to specify the address it is sent from? I've tried:

       With OutMail
            .From = "address@from.com"
            .To = Cells(start, 7)
            .Subject = "Call Closure Notification"
            .Body = Cells(start, 6)
            .Display 'or use .Display
        End With
    But this doesn't work. is there a command to do this?
    Last edited by BenRoylance; 10-09-2010 at 06:00 AM.

Thread Information

Users Browsing this Thread

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

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