+ Reply to Thread
Results 1 to 5 of 5

Changing subject line in email

  1. #1
    Registered User
    Join Date
    06-06-2006
    Posts
    41

    Changing subject line in email

    I've have a macro that will send a generic email from Excel.. My next problem in that I would like the subject of each email to reflect the infomation that are in two different cells of the workbook (say C5 and C7 of sheet1). How would I enter this in the macro to accomplish this task?

    Thanks.

  2. #2
    Norman Jones
    Guest

    Re: Changing subject line in email

    Hi Tanya,

    See the tips section on any of Ron de Bruin's email pages.

    http://www.rondebruin.nl/sendmail.htm


    ---
    Regards,
    Norman



    "tanyhart" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I've have a macro that will send a generic email from Excel.. My next
    > problem in that I would like the subject of each email to reflect the
    > infomation that are in two different cells of the workbook (say C5 and
    > C7 of sheet1). How would I enter this in the macro to accomplish this
    > task?
    >
    > Thanks.
    >
    >
    > --
    > tanyhart
    > ------------------------------------------------------------------------
    > tanyhart's Profile:
    > http://www.excelforum.com/member.php...o&userid=35148
    > View this thread: http://www.excelforum.com/showthread...hreadid=549499
    >




  3. #3
    Tom Ogilvy
    Guest

    RE: Changing subject line in email

    Dim s as String
    With worksheets("Sheet1")
    s = .Range("A1").Text & " " & .Range("B9").Text
    End With
    . . . Subject:=s, . . .

    --
    Regards,
    Tom Ogilvy


    "tanyhart" wrote:

    >
    > I've have a macro that will send a generic email from Excel.. My next
    > problem in that I would like the subject of each email to reflect the
    > infomation that are in two different cells of the workbook (say C5 and
    > C7 of sheet1). How would I enter this in the macro to accomplish this
    > task?
    >
    > Thanks.
    >
    >
    > --
    > tanyhart
    > ------------------------------------------------------------------------
    > tanyhart's Profile: http://www.excelforum.com/member.php...o&userid=35148
    > View this thread: http://www.excelforum.com/showthread...hreadid=549499
    >
    >


  4. #4
    Registered User
    Join Date
    06-06-2006
    Posts
    41

    RE:Changing subject line in email

    Tom,

    When I enter that into the macro and run it, I get a run-time error 9 - Subscript out of range. Perhaps I have it in the wrong place.

    ub Mail_small_Text_Outlook()
    'You must add a reference to the Microsoft outlook Library
    Dim myOutlook As Object
    Dim myMailItem As Object
    Dim strbody As String
    Dim s As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)
    strbody = "XXXXX" & vbNewLine & vbNewLine & _
    "Your request for estimate has been received and is in progress." & vbNewLine & vbNewLine & _
    "I have been assigned the responsibility to coordinate the return and will try to have the estimate returned to you by XXXX." & vbNewLine & _
    "If the estimate can not be delivered by this date, you will be notified."

    With Worksheets("Sheet1")
    s = .Range("A1").Text & " " & .Range("B9").Text
    End With

    With OutMail
    .to = ""
    .CC = ""
    .BCC = ""
    .Subject = s
    .Body = strbody
    .Display
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub

  5. #5
    Registered User
    Join Date
    06-06-2006
    Posts
    41

    Disregard

    Disregard, I figured it out.

    Thanks for your help.

+ 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