PDA

View Full Version : [SOLVED:] Send Email When Particular Slide Is Shown



BIBSN
09-30-2013, 02:36 AM
Hi, :hi::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? :help:help

Thanks in advance

SamT
09-30-2013, 07:07 AM
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?

BIBSN
09-30-2013, 07:58 AM
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

SamT
10-01-2013, 06:47 AM
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.

BIBSN
10-01-2013, 07:33 AM
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.

SamT
10-01-2013, 07:44 AM
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.

BIBSN
10-01-2013, 07:51 AM
Perfect

Thanks for all.

John Wilson
10-01-2013, 10:19 AM
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)

BIBSN
10-02-2013, 12:14 AM
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

John Wilson
10-02-2013, 12:33 AM
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)

BIBSN
10-02-2013, 01:20 AM
Hi,

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

John Wilson
10-02-2013, 01:29 AM
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

BIBSN
10-06-2013, 01:11 AM
Dear John,
thanks a lot for your precious support.
I used the code last friday and it was a success.
thanks
bibsn

John Wilson
10-06-2013, 09:57 AM
Thanks for the formatting Sam (I was in a rush)

Glad it worked BIBSN

SoftMast
10-31-2013, 11:49 AM
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.