none
[VBA + PowerPoint] Send PPT slides content in Outlook email body while preserving source format RRS feed

  • Question

  • Hi everyone,

    I use this code to send slide content into Outlook email body automatically

    Sub sendmail()
    Dim ret As Boolean
    Dim strAddress As String
    Dim strMessage As String
    strAddress = "you@you.com"
    strMessage = ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange ' change to suit
    ret = SendEMail(strAddress, "From PowerPoint", strMessage)
    MsgBox "Mail sent= " & ret
    End Sub
    Public Function SendEMail(strRecipient As String, strSubject As String, strBody As String) As Boolean
    Dim oApp As Object
    Dim oMail As Object
    Err.Clear
    On Error Resume Next
    Set oApp = GetObject(Class:="Outlook.Application")
    If Err <> 0 Then Set oApp = CreateObject("Outlook.Application")
    Err.Clear
    Set oMail = oApp.CreateItem(0)
    With oMail
    .Subject = strSubject
    .To = strRecipient
    'copy to self
    .CC = "you@you.com"
    .BodyFormat = 1
    .Body = strBody
    .Send
    End With
    'cleanup
    Set oMail = Nothing
    Set oApp = Nothing
    'All OK?
    If Err = 0 Then SendEMail = True Else SendEMail = False
    End Function

    The issue I'm having, is that it copy only in a bold dry text format and not the slide template, layout, fonts colors and sizes and background...

    How can I fix this, please?

    PS: I use Office 2010

    Warm Regards


    • Edited by Admin-Dev Thursday, May 9, 2013 8:27 PM
    Friday, May 3, 2013 4:43 PM

Answers