Results 1 to 15 of 15

Thread: Send Email When Particular Slide Is Shown

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,096
    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

Posting Permissions

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