Results 1 to 6 of 6

Send an Excel with Outlook using VBA and Select an email address from a cell

Threaded View

  1. #1
    Registered User
    Join Date
    04-24-2014
    Location
    Utrecht, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    6

    Send an Excel with Outlook using VBA and Select an email address from a cell

    I created a VBA which will send a sheet of a excelfile to a fixed email address in the VBA code. That is nice, but what I really want is the VBA to look at a particular cell in the activesheet (M2) to pick up the email address from there. Below is a part of the VBA code. In the section .To = "ghn@xyz.nl" I want a code which will pick up the email address. Does anyone know which code I can use??

    TempFilePath = Environ$("temp") & "\"
        TempFileName = "Fuel " & " " & Format(Now, "dd-mmm-yy")
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        With Destwb
            .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
            On Error Resume Next
            With OutMail
                .To = "ghn@xyz.nl"
                .CC = ""
                .BCC = ""
                .Subject = "Fuel"
                .Body = "Dear Sir,"
                .Attachments.Add Destwb.FullName
                'You can add other files also like this
                '.Attachments.Add ("C:\test.txt")
                .Send   'or use .Display
            End With
            On Error GoTo 0
            .Close savechanges:=False
        End With
    Last edited by TNT Innight; 02-19-2015 at 08:13 AM. Reason: I did not use the Code wrapping

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 05-13-2014, 01:25 AM
  2. Send email to address based on cell value
    By shiftyspina in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2014, 03:06 PM
  3. Send email based on address in a cell
    By behnam in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2013, 02:53 PM
  4. Macro to PDF a sheet in workbook and email (outlook) to an email address in a cell
    By paul_sykes00 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-17-2012, 12:54 AM
  5. [SOLVED] one pdf file send to 20,000 email address use vbs coding & through outlook 2003
    By sonu_kumar444 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 07-03-2012, 04:22 AM

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