Can I read a file into PowerPoint and also write to a file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to allow users to write a number of questions and answers to a file
then use that file others to load a slide with questions. These question
will be the multi choice type. One question with possible four answers.
Students will be told if the answer is wrong and hat the correct answer is.
I would like to use PowerPoint for this project. I am familar with VB and
maybe that's the way I have to go, but would prefer PowerPoint for 2 reasons,
first - it's a challenge and 2nd the users of the training aid are familar
with PowerPoint.
 
What you want is to use VBA with PowerPoint. Since you are familar with VB,
it will be relatively easy. You can see some examples of doing quizzes in
PowerPoint at my site:

http://www.loyola.edu/education/PowerfulPowerPoint/

None of my examples reads from a file or writes to a file. If you don't
already know how to do that with VB, write back here, and someone will be
able to point you in the right direction.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
I just created a training presentation I think may be similar to what you
are looking for. A userform is displayed when a hyperlink is clicked on a
slide. The training has 75 questions. One question appears with 4 choices.
Select the choice and it tells you if you are right or wrong. Click the next
button to go to the next question.
If this is what you are looking for, let me know, I can send you a copy of
the file.
 
I am very interested in applying this concept to my training sessions, can
you forward a copy of the template.

Thanks
 
You can also view a sample that writes quiz results to a file at my site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "More Tricks" and look for trick #1.

Also, if the person with the template would like to put the template on
the Web, I would love to have it on my site under "Examples from Real
People."

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Jill,
I think this would be very helpful. Can you send it to me?
(e-mail address removed). Also. Does anyone know how to create a quiz that
will write the results to Excel?
 
I didn't see anything except to a text field. I can use Access, how would I
go about that?
 
Keep in mind that it is somewhat dependent on the version of Access you
have. You also need to have your variable names and table field names
established. This might get you started. Good Luck!

'=====Code starts here=====

Sub SendData()

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.RecordSet
Dim strDataSource As String
Dim strProvider As String
Dim strRecordSource As String

' This line is when your database is in the same folder as your
presentation
strDataSource = "Data Source=" & Application.Presentations(1).Path &
"\YourDatabaseNameHere.mdb"
' This line is when your database is a specific server/folder location
' strDataSource = "Data
Source=\\yourserver\yourfolder\YourDatabaseNameHere.mdb"
' This line used for post Access 97 Access provider files
strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
' This line used for some Access provider files
strRecordSource = "YourDatabaseTableNameHere"
' Open connection
cnn.Open strProvider & strDataSource
' Open recordset
rst.Open strRecordSource, cnn, adOpenDynamic, adLockOptimistic

' add record and fill fields from data array
' The name after the "!" is the field name of the table listed earlier
' The name after the "=" is the variable name from within PowerPoint
rst.AddNew
rst!EmployeeID = strEmployeeID
rst!FirstName = strFirstName
rst!LastName = strLastName
rst!CBTNumber = strCBTNumber
rst!CBTtitle = strCBTTitle
rst!Score = Score
' This merely uses the computer's clock to record the date/time entered
rst!DateTimeAdded = Now
rst.Update
rst.Close

' I usually use the following line to make PowerPoint think the file is
saved

ActivePresentation.Saved = True

End Sub

'=====Code Stops Here=====
 
Sorry, I didn't jump in earlier. There are no examples on my site of
writing to or reading from Excel or Access. The only file operations on
my site are writing to and reading from a text file (in the More Tricks
section of my site).
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
Jill,
I think this would be very helpful. Can you send it to me?
(e-mail address removed). Also. Does anyone know how to create a quiz that
will write the results to Excel?

You can automate Excel to do this (search google on automating excel for example
code).

But it's probably a lot simpler to write it to a text file in CSV format and
with a CSV extension.

Excel will open these automatically.
 
Sorry, I realize this is a very old subject, but just what I am working on.
I have reviewed the examples from Powerful Power Point and feel I would
benefit from the book. However, I am not experienced with VB. Is this a
prerequisit?
 
The book is written with no prerequisite skills in VB or programming
necessary. At least that is what I had in mind.
--David
 
Back
Top