使用ppt的交互式测验 [英] Interactive Quiz using ppt
问题描述
我之前发布了一个关于此的垃圾问题,并且已经离开并做了一些工作以重新提问.基本上我做了一个ppt测验,计算一个人给出了多少正确和错误的答案.然后在最后将这些信息反馈给用户.但是,我现在想要发生的是我希望存储结果,以便我可以返回并查看每个用户在测验中的表现.理想情况下,我希望它可以在 6 台联网计算机上工作,将所有测验结果存储在一个地方.但如果需要,我可以从 6 台计算机中的每台计算机中取出一个文件.
I posted a rubbish question about this before and have gone away and done some work on it to re-ask. Basically I've made a ppt quiz that counts how many correct and incorrect answers a person has given. It then feeds this information back to the user at the end. However what I want to happen now is I want the results to be stored so that I can go back in and see how each user has performed in the quiz. Ideally I would like it to work over 6 networked computers storing all the quiz results in one place. But if need be I can just take a file from each of the 6 computers.
到目前为止我的代码是这样的:
My code so far looks like this:
Dim username As String
Dim numberCorrect As Integer
Dim numberWrong As Integer
Sub YourName()
username = InputBox(prompt:="Type your Name")
MsgBox " Get Ready to begin " + username, vbApplicationModal, " Orange 1C Book 7"
End Sub
Sub correct()
numberCorrect = numberCorrect + 1
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub incorrect()
numberWrong = numberWrong + 1
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Start()
numberCorrect = 0
numberWrong = 0
YourName
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Results()
MsgBox "Well done " & username & " You got " & numberCorrect & " out of " & numberCorrect + numberWrong, vbApplicationModal, "Orange 1C Book 7"
End Sub'
任何帮助将不胜感激.不知道从哪里开始下一步.
Any help would be greatly appreciated. Not sure where to begin with the next step.
推荐答案
这里有一个选项供您选择...但首先要进行一些解释.此代码将创建 TXT 文件.每次有人到达 Results
宏时,它都会将结果添加到文件中.因此,一个文件将保留所有结果,直到您不删除它们(或文件).因此,我添加了分隔线和日期/时间信息,以便您轻松找到合适的结果.
Here goes one option for you... But some explanation first. This code will create TXT file. Each time someone will reach Results
macro it will add results to the file. So, one file will keep all the results until you don't delete them (or the file). Therefore I've added separation line and date/time information for you to easily find appropriate results.
Sub Save_Results_To_Txt()
'set file results location to activepresentation path
'or could be changed to any path string
Dim strWhere As String
strWhere = ActivePresentation.Path
'let's set name of the file separately
Dim strName As String
strName = "\results.txt"
Dim ff As Long
ff = FreeFile
Open strWhere & strName For Append As #ff
Write #ff, Now & vbTab & username
Write #ff, numberCorrect & vbTab & vbTab & numberWrong
Write #ff, String(30, "-")
Close #ff
End Sub
您需要将 Save_Results_To_Txt
添加到您的 Results
子中,可能在 MsgBox
行之前.
You need to add Save_Results_To_Txt
to your Results
sub, possibly before MsgBox
line.
您的 results.txt 文件将如下所示:
Your results.txt file will look like:
"2013-04-25 16:11:05 Tom"
"10 11"
"------------------------------"
"2013-04-25 16:11:23 Mark"
"11 10"
"------------------------------"
这篇关于使用ppt的交互式测验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!