Consulting

Results 1 to 4 of 4

Thread: Solved: Automate creation of form e-mail each month (with date input)?

  1. #1

    Solved: Automate creation of form e-mail each month (with date input)?

    I've got several e-mail requests I make each month for information from hedge fund managers regarding their portfolios (% invested in a specific region, % cash, etc.).

    I request the same information from the same people each month, but each e-mail is unique because I'm writing a single, specific e-mail to a specified person regarding their fund and I am requesting information that relates only to that fund.

    However, I do this every month for about a dozen managers, and the only thing that changes in the subject and body are the month to which I am referring (so every time a new month comes around I copy and paste my old e-mail text and subject into a new e-mail addressed to the person and put in the new date info and send it off). I'd like to be able to automate it so that when I run my code it asks me for the date string (doesn't have to be in a date format, it can be 5/31/06 or May 31, 2006, any old text string really) and automatically creates the individual e-mails in my draft folders addressed properly with the specified subject (with the proper date) and proper body text. Is there a way for me to write this in VBA?

    Thanks!

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi,

    This should get you started:[vba]
    Sub SaveEmail()
    Dim oItem As Outlook.MailItem

    Set oItem = Application.CreateItem(olMailItem)

    With oItem
    .To = InputBox("Provide E-mail")
    .Subject = InputBox("Please provide the subject")
    .Body = "Dear " & InputBox("Please provide name") & "," & vbCr & _
    "a bunch of text over here" & vbCr & vbCr & _
    "the changed date is: " & Format(CDate(InputBox("date")), "mmm, dd yyyy") & _
    " a whole lot more text" & vbCr & vbCr & "Good luck to you!"

    .Save
    End With

    Set oItem = Nothing
    End Sub
    [/vba]

    HTH.
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  3. #3
    Works perfectly! I've modified it to ask for the date only once and it now inserts the date in the subject as well as the body.

    Thanks so much for your help!

    Kipp

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi Kipp,

    Glad I could help..
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •