Results 1 to 4 of 4
  1. #1
    EvanScamman
    Guest

    Insert an Excel table into an Outlook Mail Message (1.0)

    I'm trying to insert an excel table into on Outlook mail message. I can create the table, fill it with the data, and even copy it to my clipboard, but i don't know how to paste the table into my mail message.

    is using the clipboard even a good method? should i be using DDE?

    thanks,
    Evan

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert an Excel table into an Outlook Mail Message (1.0)

    Evan,
    Use the SendObject method:
    DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]

    This is a sample from the help file :
    <pre>DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _
    "Nancy Davolio; Andrew Fuller", "Joan Weber", , _
    "Current Spreadsheet of Employees", , False
    </pre>

    Francois

  3. #3
    EvanScamman
    Guest

    Re: Insert an Excel table into an Outlook Mail Message (1.0)

    Thanks for the reply Francois.
    I am not sure if this method will work.
    1st, i am not sending an entire table to outlook, only a few fields from a few selected records.
    Also, i want the excel table to appear in the body of the email, not as an attachment.

    Here are some excerpts of my code:

    This creates the email:

    Set golApp = New Outlook.Application
    Set objNewMail = golApp.CreateItem(olMailItem)
    With objNewMail
    .Recipients.Add varRecip ' varRecip is a variable containing name of person to send email to
    .Subject = strSubject
    ' .Body = strMessage ' until now i've been sending the body as an unformatted string - but i want to change this, and send an excel table here instead...

    Here's my code for creating the excel table:
    Dim xlobject As Object, xlsheet As Object

    Set xlobject = CreateObject("excel.sheet.5")
    Set xlsheet = xlobject.Application.activeworkbook.sheets("sheet1 ")

    With xlsheet
    .range("a1").Value = !Quantity
    .range("b1").Value = !Cost

    End With

    ------------------
    This will create the excel table with my data, now i need to bridge the gap between excel and outlook.
    How do i get this data into the .body of my email?

    Thankyou,
    Evan

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert an Excel table into an Outlook Mail Message (1.0)

    Evan,
    I have been playing( <img src=/S/baby.gif border=0 alt=baby width=15 height=15>) a little with your code and in the attachment you find a the results of it.
    I have to add a function to get data from the clipboard.
    I hope you can work it out to something working for you.
    Attached Files Attached Files
    Francois

Posting Permissions

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