Re: PowerPoint VBA
From: Bill Foley (wfoley1_at_EATSPAMANDDIEtxu.com)
Date: 04/20/04
- Next message: Sonia: "Re: PP Org Charts"
- Previous message: A. Rhoades: "PP Org Charts"
- In reply to: Marge S: "Re: PowerPoint VBA"
- Next in thread: Steve Rindsberg: "Re: PowerPoint VBA"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Apr 2004 08:19:22 -0500
Here is some sample code. Keep in mind that this includes several variables
I use in my CBTs. You will need to modify accordingly. ENJOY:
=========Code starts here=======
' Remember you need to set a reference to Outlook in the VBE window.
' Click "Tools", "References", place a check next to "Microsoft Outlook X.0
Object Library" (depends on version)
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 "put address here"
Mail.Subject = "put subject here"
Mail.Body = "I have completed the PTT, Inc. CBT 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 contact blah-blah-blah and report an
error", vbOKOnly, "Error Occurred"
Complete:
End Sub
========Code Ends here========
-- Bill Foley, Microsoft MVP (PowerPoint) www.pttinc.com Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/ Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm "Marge S" <m_sulla@hotmail.com> wrote in message news:GM8hc.59964$I83.1170697@twister.tampabay.rr.com... > Thank you. Code for Outlook would be great and appreciated. I have outlook > running in Windows XP. > This is terrific. The more ways, the merrier. Marge Sulla > > > "Bill Foley" <pttincnospam@itexas.net> wrote in message > news:%23UIk%23xnJEHA.528@tk2msftngp13.phx.gbl... > > What e-mail program do you use? I can send sample code for Outlook or > Lotus > > Notes. What version of Office? > > > > -- > > Bill Foley, Microsoft MVP (PowerPoint) > > www.pttinc.com > > Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/ > > "Success, something you measure when you are through succeeding." > > > > "Marge S" <m_sulla@hotmail.com> wrote in message > > news:CSVgc.58686$I83.1077147@twister.tampabay.rr.com... > > > Thanks Bill, I think all I would need is how to collect the variables > and > > > send an email. > > > I was trying to do an OpenTextFile command. Do you see anything > wrong > > > with what I wrote below? TristateFalse should open the file as an ascii > > > file. > > > Thanks, Marge S. > > > > > > Sub OpenEndOfDayFile() > > > Const ForReading = 1, ForWriting = 2, ForAppending = 3 > > > Dim fs, f > > > Set fs = CreateObject("Scripting.FileSystemObject") > > > Set f = fs.OpenTextFile("c:\mytestfile.txt", > > ForAppending,TristateFalse) > > > f.Write userName > > > f.Close > > > End Sub > > > > > > > > > > > > "Bill Foley" <wfoley1@EATSPAMANDDIEtxu.com> wrote in message > > > news:eevWcIkJEHA.4072@TK2MSFTNGP12.phx.gbl... > > > > I usually port mine to an Access database or send an e-mail upon > > > completion. > > > > You can check out my demo I have at: > > > > > > > > http://www.pttinc.com/power_point.htm#PowerPoint > > > > > > > > If you think you might want to send to Access, let me know, I can send > > you > > > a > > > > sample file with the database portion. I have another one that > collects > > > the > > > > choices made with multiple choice radio buttons that pops up a message > > box > > > > at the end, keeps score, etc. > > > > > > > > Holler and I can get with you to provide some examples. > > > > > > > > -- > > > > Bill Foley, Microsoft MVP (PowerPoint) > > > > www.pttinc.com > > > > Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/ > > > > Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm > > > > > > > > "Marge S" <m_sulla@hotmail.com> wrote in message > > > > news:PkVgc.58551$I83.1074879@twister.tampabay.rr.com... > > > > > Hi, I have developed some slides in PowerPoint whereby I take user > > > input. > > > > I > > > > > store information from the user in variables such as userName, > > Answer1, > > > > > Answer2, etc. I am fairly new to this (Not PPT but VBA). How do I > > write > > > a > > > > > Sub to save this user info I collected, when the user finished the > > last > > > > > question? > > > > > I tried to do something with writing to a textfile, but it never > > worked > > > > even > > > > > though I copied the exact script from the help module. In Perl it is > > so > > > > easy > > > > > to write to or append a text file. > > > > > I really appreciate any help you can give. I am trying to write some > > > > simple > > > > > projects teachers can use with students and see how easy it is to > > > collect > > > > > info and have a very interactive PowerPoint. Thus far I can only > make > > > this > > > > > provide a summary slide that the student can print out and that is > not > > > > > acceptable (too many students would accidentally shut the program > down > > > > > before printing). I can make VBA do all kinds of things but not save > > the > > > > > variable information. > > > > > I have looked through dozens of 1000 paged text on VBA and nowhere > do > > > they > > > > > say how to store data you collect through Input boxes in PowerPoint > to > > > an > > > > > ascii text file. > > > > > Thanks for anything anyone has to offer, > > > > > Marge S. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
- Next message: Sonia: "Re: PP Org Charts"
- Previous message: A. Rhoades: "PP Org Charts"
- In reply to: Marge S: "Re: PowerPoint VBA"
- Next in thread: Steve Rindsberg: "Re: PowerPoint VBA"
- Messages sorted by: [ date ] [ thread ]