+ Reply to Thread
Results 1 to 5 of 5

Simple Array

  1. #1
    Forum Contributor
    Join Date
    01-18-2005
    Posts
    238

    Simple Array

    How can I create an array or something similiar for the following situation?

    I want to email something to 10 different people

    instead of typing in all 10 names like

    With OutMail
    .To = "number1@mydomain.com", "number2@mydomain.com"
    End with

    Is there anyway to make an array

    All of the email addresses are on Sheet1 Range(A1:A20)...not all cells in the range have email, some are blank

    thanks for any help

    Josh

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Would something like this work

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    If that doesn't help then try Ron De Bruin site

    http://www.rondebruin.nl/mail/folder1/mail2.htm

    VBA Noob

  4. #4
    Registered User
    Join Date
    04-12-2006
    Posts
    25
    You can try this:

    Sub SendMessage()
    Dim OL As New Outlook.Application
    Dim MI As MailItem
    Dim strAddresses As String
    Dim strAddress As String
    Dim aCell As Range


    Set OL = New Outlook.Application
    Set MI = OL.CreateItem(olMailItem)

    For Each aCell In Range("your range")
    If aCell = Empty Then
    Else
    strAddress = aCell.Value
    strAddresses = strAddresses & strAddress & ";"
    End If
    Next aCell
    strAddresses = Left(strAddresses, Len(strAddresses) - 1)

    With MI
    .To = strAddresses
    .Subject = "your subject"
    .Body = "Here the text you want to mail"
    .Display
    End With

    Set OL = Nothing
    Set MI = Nothing
    End Sub

  5. #5
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

+ 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