Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to open email template (XP)

    I'm looking for a way to just open up an email template from within Excel. I'm not actually pulling any data from the spreadsheet. I just need to open a new email message with a few lines of text and a generic subject.

    I don't need to send it (yet). I'll be filling in the "To" and then sending it.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to open email template (XP)

    For a simple e-mail, you can use this instruction:

    ActiveWorkbook.FollowHyperlink "mailto:&subject=Test e-mail&body=This is a test of the emergency broadcasting system."

    The body text can consist of several sentences, but you can't insert line breaks using this command.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to open email template (XP)

    Thanks Hans.

    Works as needed.

    Is there a way to do this so that I can insert line breaks? I'm assuming it's not possible for the mailto command.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to open email template (XP)

    Mailto doesn't support line breaks in the message. You'd need to automate Outlook (if that's the mail client you're using), which is quite possible but more work. See for example <post:=568,796>post 568,796</post:>.

  5. #5
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to open email template (XP)

    Fantastic!

    I can get this to work.

    Thanks again.

  6. #6
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to open email template (XP)

    Just wondering...

    Is it possible to launch a Meeting Maker or Appointment this way?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to open email template (XP)

    You can modify the code from <post:=568,796>post 568,796</post:> to create other Outlook items, such as an appointment, a contact or a task. For example:

    Sub CreateAppointment(sSubj As String, dStart As Date, lDuration As Long)
    Dim oOLapp As Objecttion
    Dim oAppointment As Object
    Set oOLapp = CreateObject("Outlook.Application")
    Set oAppointment = oOLapp.CreateItem(1)
    With oAppointment
    .Subject = sSubj
    .Start = dStart
    .Duration = lDuration
    .Display
    End With
    Set oOLapp = Nothing
    Set oAppointment = Nothing
    End Sub

    Call like this:

    CreateAppointment "Lunch with CEO", #7/20/2006 1:00:00 PM#, 30

    In order to create other variations, you'd have to study Outlook VBA (a rather esoteric subject, I'm afraid)

Posting Permissions

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