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 SubSub 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




Reply With Quote