Consulting

Results 1 to 15 of 15

Thread: Send Email When Particular Slide Is Shown

  1. #1
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location

    Thumbs up Send Email When Particular Slide Is Shown

    Hi,

    I would like to send an e-mail to some recipients with a specific attachment when I'm showing a specific slide.
    Let me explain:
    I have prepared a pdf with some information inside.
    I would like to sent it to all partecipants of the meeting.
    When I show one specific slide of my presentation, in the same time, I would like that powerpoint sends the e-mail to the all recipients

    Can anybody help me?

    Thanks in advance

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Where is your list of participants kept? File name and folder.

    Where is the pdf kept? Folder and file name.

    What are the names of the PP presentation and the specific Slide ?

    Do you always show the slide, or can the pdf be sent every time you show the presentation?

    How much do you know about VBA coding?
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    Dear SamT,

    thanks in advance.

    1) I have a list of partecipants an I can/will insert it manually (normaly they are always the same) or prepare a file Excel for example
    2) the PDF is in my computer, in a specific folder (the same of ppt).
    3-4) I have several files that I would like to do this implementation, so if is possible to have a generic vba.
    ex. I have a ppt with 40 slides and I would like to send automatically an email with an attachment when I show the 25th slide.
    5) I have a basic know about vba, normali i use VBA in excel and for Word but not for Powerpoint.

    I hope to be clear.
    thanks

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Quote Originally Posted by SamT View Post
    Where is your list of participants kept? File name and folder.

    Where is the pdf kept? Folder and file name.

    What are the names of the PP presentation File and the specific Slide ?
    VBA is a very exact language.

    The Coder must know exact details.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    List partecipant: c:/Lavoro/riunioni/Ottobre/lista.txt
    PDF : c:/Lavoro/riunioni/Ottobre/catalogotrade.epub
    PP Presentation: Meeting.pptx and the slide is the number 15 th

    But if i will use the code for another presentation i will have only to change this information with the new one?

    Thank a lot.

  6. #6
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    We will make the code universal and make it easy to input the desired parameters.

    I will now change the thread Title to attract Power Point experts.

    Desired Features: File selectors for "List Partecipant" file and PDF file. Input box for Triggering Slide number.





    BIBSN, do not reply until an expert answers, leave my name as Last Post. It might help.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  7. #7
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    Perfect

    Thanks for all.

  8. #8
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Are you using Outlook as the mail client and which version of Office? Other mail clients will be a problem.

    You should also be aware that Outlook and most other clients will not be happy sending email from code unless you reduce security levels. This is a major way viruses spread (or is that viri)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  9. #9
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    Hello John,
    I use office 2010 with Outlook.
    I know that I have to reduce the security option to run a macro. But this is not a problem.
    Thanks

  10. #10
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Hi

    I'll look at a demo macro later

    The problem is not just enabling macros If you allow PowerPoint to auto send an email with code Outlook will pop up a message
    "A program is trying to send an email on your behalf etc" Your audience will see this by default unless you change settings (not macro security)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  11. #11
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    Hi,

    So you can explain what I have to do to don't show the popup/message?
    Tanks

  12. #12
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You could try something like this
    You may have to experiment for a while as obviously I don't have your files.

    Don't forget to add the Control Toolbox Item on slide 1 (see note in last code sub)

    You can change the security setting in File > Trust Center > Trust Center Settings .>Programmatic Access You should NOT leave this setting when you finish.

    Option Explicit
    'change as required
    Const strATTACH As String = "c:/Lavoro/riunioni/Ottobre/catalogotrade.epub"
    Const strSUBJECT As String = "An Email from Lavoro"
    Const strBODY As String = "Blah, blah, blah."
    Const strTextFilePath As String = "c:/Lavoro/riunioni/Ottobre/lista.txt"
    Sub mailer()
    'reads the address and sends mail
    'may take a while if the epub is large
    Dim olApp As Object, olMail As Object
    Dim strADDRESS As String
    Dim fileNum As Integer
    fileNum = FreeFile()
    Set olApp = CreateObject("Outlook.Application")
    Open strTextFilePath For Input As #fileNum
    Do While Not EOF(fileNum)
    On Error Resume Next
    
    Line Input #fileNum, strADDRESS
    Set olMail = olApp.CreateItem(0)
    olMail.To = strADDRESS
    olMail.Subject = strSUBJECT
    olMail.Body = strBODY
    olMail.Attachments.Add strATTACH
    olMail.Send
    Loop
    Close #fileNum
    End Sub
    Sub OnSlideShowPageChange(SW As SlideShowWindow)
    ' this calls mailer when slide 15 opens
    'note to make this more reliable place any object from the
    'Control Toolbox e.g. a command button just off slide 1
    If SW.View.CurrentShowPosition = 15 Then Call mailer
    End Sub
    Last edited by SamT; 10-02-2013 at 04:31 AM. Reason: Added Code Tags with # button
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  13. #13
    VBAX Regular
    Joined
    Sep 2013
    Posts
    8
    Location
    Dear John,
    thanks a lot for your precious support.
    I used the code last friday and it was a success.
    thanks
    bibsn

  14. #14
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Thanks for the formatting Sam (I was in a rush)

    Glad it worked BIBSN
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  15. #15
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    5
    Location
    Quote Originally Posted by John Wilson View Post
    You could try something like this
    You may have to experiment for a while as obviously I don't have your files.

    Don't forget to add the Control Toolbox Item on slide 1 (see note in last code sub)

    You can change the security setting in File > Trust Center > Trust Center Settings .>Programmatic Access You should NOT leave this setting when you finish.

    Option Explicit
    'change as required
    Const strATTACH As String = "c:/Lavoro/riunioni/Ottobre/catalogotrade.epub"
    Const strSUBJECT As String = "An Email from Lavoro"
    Const strBODY As String = "Blah, blah, blah."
    Const strTextFilePath As String = "c:/Lavoro/riunioni/Ottobre/lista.txt"
    Sub mailer()
    'reads the address and sends mail
    'may take a while if the epub is large
    Dim olApp As Object, olMail As Object
    Dim strADDRESS As String
    Dim fileNum As Integer
    fileNum = FreeFile()
    Set olApp = CreateObject("Outlook.Application")
    Open strTextFilePath For Input As #fileNum
    Do While Not EOF(fileNum)
    On Error Resume Next
    
    Line Input #fileNum, strADDRESS
    Set olMail = olApp.CreateItem(0)
    olMail.To = strADDRESS
    olMail.Subject = strSUBJECT
    olMail.Body = strBODY
    olMail.Attachments.Add strATTACH
    olMail.Send
    Loop
    Close #fileNum
    End Sub
    Sub OnSlideShowPageChange(SW As SlideShowWindow)
    ' this calls mailer when slide 15 opens
    'note to make this more reliable place any object from the
    'Control Toolbox e.g. a command button just off slide 1
    If SW.View.CurrentShowPosition = 15 Then Call mailer
    End Sub
    Tnx.

Posting Permissions

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