Automatically inserting an attachment into an email from Powerpoin

L

Lazlo Woodbine

I'm putting together an 'interactive' Powerpoint Presentation where I am
providing information but also, through the use of VBA Textboxes allowing
people to enter comments (I'm basically showing some 'plans' for an area and
consulting people on their views - i though a slide show with limited
interaction might be a good idea).

The big question is how to compile people's comments and then get them
emailed back to me. The most logical option, IMO, would be to compile the
comments into a text file and then have that emailed to me as an attachment.

What I want to do is for pepole to comment, then press a button and for
Outlook to open with the address, subject header and attachment to be in
place.

I can do the email address and subject - but can't work out how to do the
attachement. Is it possible?

Alternatively, is there another way of transferring comments from PP to the
email.

Thanks

Laz
 
B

Bill Foley

Actually it might be easier to have variables that include these text items
then put them into the "Body" of the message instead of having to attach a
file. One thing to keep in mind that is with the new security of Outlook
the user will get a message or two that "someone is trying to access their
address book and trying to send a message, is this okay"!

Most of the times I port the data to Microsoft Access because my stuff is
normally used within the same company (Intranet). For your example, an
e-mail is probably required. Just be sure to let your users know that they
need to click "Accept" when asked.

Here is a link to my sample CBT that uses Microsoft Access:
http://www.pttinc.com/cbt_development.html

You can use the "&" to concatenate both regular text and variables using
VBA. For example, the following code (Outlook XP) will send a message to
the desired recipient with the body of the message based On both text and
variables. I use this type of feature when developing Computer Based
Training (CBT) using PowerPoint.

Here is a very simple sample code based on what I use for e-mail versions of
my program. Keep in mind that I have some variables (Score, firstname,
lastname, etc. captured at other places throughout my presentation. These
are saved and put in the body of the message.

'=====Code Starts Here=====
' Remember you need to set a reference to Outlook.
' Click "Tools", "References", place a check next to "Microsoft Outlook 9.0
Object Library

Sub MailThruOutlook()

On Error GoTo Err1
Dim OL As Outlook.Application
Dim Mail As MailItem

Set OL = CreateObject("Outlook.Application")
Set Mail = OL.CreateItem(olMailItem)
Mail.Recipients.Add "your email address here"
Mail.Subject = "PTT PowerPoint CBT Demo Reviewed"
Mail.Body = "I have reviewed the presentation. I scored " & Score * 100
& _
"% on the quiz." & Chr(10) & "First name: " & firstname & Chr(10) &
_
"Last name: " & lastname & Chr(10) & "SSN: " & SocialSecurityNumber
& Chr(10) & _
"My feedback is:" & strFeedback
Mail.Send
Set Mail = Nothing
Set OL = Nothing

MsgBox "You have successfully completed the PTT, Inc. PowerPoint CBT Demo.
Press ESC to exit this program.", vbOKOnly, "PPT Complete"
GoTo Complete
Err1:
MsgBox "An error has occurred. Please call Professional Training
Technologies, Inc. at 877-478-8462 and report an error", vbOKOnly, "Error
Occurred"
Complete:
End Sub
'=====Code Ends Here=====

Good luck!
 
L

Lazlo Woodbine

Thanks Bob.
I've used your code and it works really well.
I assume that it won't work with Outlook Express users or people using a
different version of Outlook? (if they were to download the presentation
from the web)

Nevermind if that is the case, I assume I can always add some instructions
on how to attach the file (or something).

This is really useful though.

Thanks for your help.
 
B

Bill Foley

You are correct, Outlook Express does not its Object Model exposed such that
you can automate it with VBA. There are other methods though (MAPI)
available, but this is what I use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top