Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
Sub PrintScreenAndEmail()
    Dim tempFilePath As String
    Dim outlookApp As Object
    Dim outlookMail As Object
    Dim activeSlide As Slide
    
    'Get active slide
    Set activeSlide = ActivePresentation.SlideShowWindow.View.Slide
    
    'Save print screen as temporary file
    tempFilePath = CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2).Path & "\PrintScreen.jpg"
    activeSlide.Export tempFilePath, "JPG"
    
    'Create new email
    Set outlookApp = CreateObject("Outlook.Application")
    Set outlookMail = outlookApp.CreateItem(0)
    
    'Add screenshot to email
    outlookMail.Attachments.Add tempFilePath
    
    'Add recipients and subject
    outlookMail.To = "john.doe@example.com; jane.doe@example.com"
    outlookMail.Cc = "peter.doe@example.com; mary.doe@example.com"
    outlookMail.Bcc = "secret.recipient@example.com; confidential.recipient@example.com"
    outlookMail.Subject = "Print Screen of PowerPoint Slide"
    
    'Add message to email body
    outlookMail.Body = "Please see the attached screenshot of the PowerPoint slide."
    
    'Send email
    outlookMail.Send
    
    'Delete temporary file
    Kill tempFilePath
    
    'Close presentation
    ActivePresentation.Close
    
    'Show message box
    MsgBox "Thank you for taking the survey.", vbInformation + vbOKOnly, "Survey Completed"
End Sub


What I have tried:

The vb code is not copying the active slide show, else hidden animation are reflected
Posted
Updated 3-May-23 23:36pm
v2

1 solution

You are exporting the active slide as an image, so there won't be any animation. Try
VB
activeSlide.Export tempFilePath, "GIF"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900