+ Reply to Thread
Results 1 to 3 of 3

Populating email from outlook from column

Hybrid View

  1. #1
    Registered User
    Join Date
    12-30-2010
    Location
    Huddersfield, England
    MS-Off Ver
    Excel 2010
    Posts
    58

    Question Populating email from outlook from column

    Hi,

    Can someone please help? I am looking to for a macro to populate email address in the 'To' section from a wookbook, but the email address depends on what is in column A. So if the number in column A is 1 then the email address the match in column B is transfered into the email header. Does this make sence and can it be done?

    Regards,

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Populating email from outlook from column

    Yes it can be done. Just have a switch in your macro as so:

    
    Dim ToAddy as string
    
    for Sweep = 1 to Range("A65536").End(xlup).Select 
         if cells(sweep, 1).value = 1 then 
                ToAddy = cells(sweep, 2).value
         else
                ToAddy = cells(sweep, 3).value ' or whereever the alternate email addy is.
         end if
    
         ActiveWorkbook.SendMail Recipients:=ToAddy, Subject:="whatever"
    next Sweep

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Populating email from outlook from column

    or
    sub snb()
      sn=filter([transpose(if(A1:A1000=1,B1:B1000,""))],"@")
      msgbox join(sn,",")
     ActiveWorkbook.SendMail Recipients:=sn
    end sub
    The msgbox is only for illustration purposes.



+ Reply to Thread

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