题库建设与试卷的生成

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Word中建设题库与生成试卷方式的研究
本项研究于2005年初调试完毕,一直使用到现在,达到了预期的目标,实现了题库建设的群众化,试卷编制的集中化,由教务处集中利用题库生成试卷,在两周的时间内,一个人操作,就完成了近百门课程的出题任务,大大提高了编制试卷的效率、标准和保密性。

现将该成果的主要技术项目介绍如下。

操作窗体:
生成的试卷:
(一)建设题库
1.建设试题库的基本步骤
①文件存放。

教务处按照系、教研室(有的系可省略)、年级+专业、课程+班级+任课教师的文件夹顺序进行分类存放试题。

②试题分类和文件名称。

同一种类型题必须放在同一个Word文件中(有几种类型题就需要几个WORD文件,文件名:课程名的拼音简称+顺序号,如fjgy1、fjgy2、fjgy3等。

2.试题库中试题和答案的基本格式要求
①出题说明。

每个类型试题Word文件的第一段为该类型题的出题说明(该类型题的总分、单位分值和答题时的要求)。

②试题编号。

从第二段开始为试题和答案,每个试题要有编号,如果试题分值不等,应在编号后再加上分值(填空题,则是题中空的数量)。

编号不能用自动编号,必须靠左边,前面不得加空格,不得缩进,不能出现差错。

③题内编号。

题内有自己的内容编号时,编号必须用括号括起来,不得与试题编号相混。

选择题的供选答案编号用字母:A. B. C. D.,或⑴⑵⑶⑷或①②③④。

④答案。

在每道试题的后面是该试题的答案,在答案的前面必须使用标记符号(“/”)供程序识别。

如果不想填答案的时候,也必须加上“/”,防止与下一题相混。

⑤字号、行距和空行。

所有试题均为5号字,填空题行间距为1.5,其它行间距均为1,解释名词、简答题等要在试题后插入答题所需的空行。

⑥间隔符。

在试题编号、分值、答案标记符号、试题正文和答案正文之间要有空格间隔。

⑦表格。

必须在文本框中使用表格或使用Excel表格(可直接在Word中插入Excel表格)。

文本框版式:必须为嵌入式。

⑧图形。

如果所需图形是由多个元素组成,则必须将各元素组合成一个对象(此项工作可以在Word中完成,也可以在其它图形编辑软件中完成)。

图形版式:必须为嵌入式。

⑨数学公式。

需使用公式编辑器。

⑩试题内容和题量。

题库中不能有重复内容的题。

软件采用机械分段(保证知识的覆盖面)和段内随机抽题的方式选取试题,只能保证同一编号的题不会在同一个试卷中出现,但不能判断不同
题之间内容是否相同。

题量要够数,每个类型题中的小题数量也要够数,如出三套题的量,则每个题型都要有三套题的量,可略多,但绝不能少。

3.不同类型试题举例:
一、单项选择(每题2分,共10题,合计20分)(第一段为题的说明部分)
1 执行价值单方向转移的货币职能是()。

A.价值尺度
B. 流通手段
C. 支付手段
D. 贮藏手段
/ C
2 已知轴线正交的圆柱和圆锥具有公切球,正确的投影是()。

/ C
3 将物体删除用下列哪个命令。

()
A B C D
/ A
二、判断题:(每小题1分,共10小题,合计10分)
1 与均能使物体放大,二者在本质上没有区别。

()
/ ×
三、填空题(每空1分,共20个空,合计20分)(要设置成1.5倍的行距)
1 5 货币的职能包括:、、、
和。

/ 价值尺度,流通手段,贮藏手段,支付手段,世界货币。

2 3 表示:( ) 表示:( ) 表示:( )
/ 消隐着色平面着色光滑着色
3 1
=
+
+
+
-

→n
n
n
n
n
n2
2
3
5
1
4
lim
.(用公式编辑器编写的公式)
/ ∞
四、简答题(包括名词解释、简答、计算、填图等类型题)
1 试作一直线HG平行与直线AB,且与直线CD、EF相交。

(图形的版式,需设置成嵌入格式)
利用
/ 答:首先点击编辑工具栏中偏移复制命令,在命令栏中输入要偏移的距离,一般以毫米为单位,击回车键或空格键,选择物体,然后选择要往哪边偏移,就在原来物体的上或下(左或右)点击一下。

即可完成偏移复制。

3 用Excel设计的表
/
4 在文本框中设计的表
/
5 简述控制和调节发酵pH的方法。

(答案或题中的编号用括号括起来了)
/ (1)根据菌种特性和培养基性质,选择适当的培养基成分和配比,有些成分可在中间补料时补充调控。

(2)加入适当的缓冲剂,以控制培养基的pH的变化。

以碳酸钙使用最普遍,主要是中和各种酸类产物,防止pH急剧下降。

(3)在发酵过程中出现pH过高或过低的情况时,可以直接加入酸或碱类物质加以调节,使之迅速恢复正常,也可用多加糖、油等来降低pH,或加入氨水、尿素等提高pH。

(二)生成试卷
1.建立试卷模板和答案模板,统一试卷格式。

按照学校统一的试卷格式要求,在Word中建立试卷模板,并以“试卷”为名保存该文件,采用同样的方式,建立答案模板,并以“答案”为名保存该文件。

2.启动试卷生成系统。

①打开试题模板、答案模板和生成该试卷所涉及的各类型题的Word文件(试题库文件)。

②选择工具->宏菜单,打开宏对话框,选择“试卷生成系统”,然后单击运行按钮,即可启动试卷生成系统(要将宏的安全性降为“允许运行宏”)。

(见操作窗体图)
3.随机抽取试题,生成考试用的试卷和答案的Word文件。

在抽题时,程序先根据已知该题型的
总分和单位分值计算出抽取的试题数,再由程序根据统计出的试题量,计算出平均N道题抽取一道试题,然后,从前到后每N道题为一段,从每一段中随机抽取一道试题。

这样设计,即考虑到了抽题的随机性,也考虑到了所抽试题在各章节分布上的均恒性,因此,在教师编写试题时,要按章节的先后顺序依次排列试题,重点章节的题量要大一些,抽取试题的比例就大一些。

具体操作步骤:①根据窗体的要求和该类型题库文件第一段文字的出题说明,填上题库文件名、该类型题在试卷中的编号、该类型题的总分和该类型题的单位分值,再选择随机出题方式和题型,如果没有所需要的题型,可选择其它,运行程序时,直接将该类型题库文件第一段文字的出题说明复制粘贴到所生成的试卷上。

②各选项选择完之后,单击开始出题按钮,即可完成一种类型题的出题工作,所抽取的试题将按顺序自动编号并粘贴到试卷模板上,同时对应的答案也将按顺序自动编号并粘贴到答案模板上。

③重复以上操作,即可生成试卷(见前面生成的试卷图)和答案的完整Word 文件。

4.按照一定规律抽取试题,生成练习用的试卷和答案的Word文件。

如需要将试题库中的试题组合成练习用的试卷,则可选此项操作,把所有试题分别组合成几套不同的试卷,供学生练习时使用。

5.试卷内容和格式的调整及打印。

生成Word试卷后,可根据需要方便的更换不合适的试题或附加必要的说明,并可进行必要的格式调整,然后保存文件和打印输出。

(三)安装与调用。

只要将UserForm1和NewMacros1.bas两个文件导入到Word的Microsoft Visual Basic-Normal的工程中(Word2003以上版本中均可使用),就可以宏的方式调用该程序,完成试卷及答案的自动生成工作。

NewMacros1.bas(代码)
Sub 试卷生成系统()
UserForm1.Show (0)
End Sub
UserForm1.frm(代码)
Public wjm As String
Public ts As Integer
Public bt As String
Private Sub CommandButton1_Click()
wjm = TextBox1.Text
name1 = wjm + ".doc"
Documents(name1).Activate
bt = ActiveDocument.Paragraphs(1).Range Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting With Selection.Find
.Text = " "
.Replacement.Text = " "
End With
Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting With Selection.Find
.Text = "/"
.Replacement.Text = "/"
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
Documents(name1).Save
ts = Val(TextBox2.Text) / Val(TextBox3.Text)
wjm = TextBox1.Text
If OptionButton3.Value = True Then
bt = TextBox4.Text & "、" & OptionButton3.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton4.Value = True Then
bt = TextBox4.Text & "、" & OptionButton4.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分,对的打“√”,错的打“×”)"
End If
If OptionButton5.Value = True Then
bt = TextBox4.Text & "、" & OptionButton5.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton6.Value = True Then
bt = TextBox4.Text & "、" & OptionButton6.Caption & "(每空" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton7.Value = True Then
bt = TextBox4.Text & "、" & OptionButton7.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton8.Value = True Then
bt = TextBox4.Text & "、" & OptionButton8.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton9.Value = True Then
bt = TextBox4.Text & "、" & OptionButton9.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
'If OptionButton10.Value = True Then
'bt = TextBox4.Text & "、" & OptionButton10.Caption & "(每小题" & TextBox3.Text & "分,
" & "共" & TextBox2.Text & "分)"
'End If
If OptionButton11.Value = True Then
bt = TextBox4.Text & "、" & OptionButton11.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton12.Value = True Then
bt = TextBox4.Text & "、" & OptionButton12.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton13.Value = True Then
bt = TextBox4.Text & "、" & OptionButton13.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
'If OptionButton14.Value = True Then
'bt = TextBox4.Text & "、" & OptionButton12.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
'End If
If OptionButton15.Value = True Then
bt = TextBox4.Text & "、" & OptionButton15.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
'If OptionButton16.Value = True Then
'bt = TextBox4.Text & "、" & OptionButton16.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
'End If
If OptionButton12.Value = True Then
bt = TextBox4.Text & "、" & OptionButton12.Caption & "(每小题" & TextBox3.Text & "分," & "共" & TextBox2.Text & "分)"
End If
If OptionButton1.Value = True Then
If OptionButton3.Value = True Or OptionButton4.Value = True Or OptionButton15 Or OptionButton16 Then
d2
Else
If OptionButton5.Value = True Or OptionButton11.Value Or OptionButton13 Or OptionButton14 = True Then
d11
Else
d1
End If
End If
Else
If OptionButton3.Value = True Or OptionButton4.Value = True Or OptionButton15 Or OptionButton16 Then
d6
Else
If OptionButton5.Value = True Or OptionButton11.Value = True Or OptionButton13 Or OptionButton14 = True Then
d12
Else
d5
End If
End If
End If
End Sub
Private Sub CommandButton2_Click()
Selection.InsertBreak Type:=wdSectionBreakNextPage
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=1
.EvenlySpaced = False
.LineBetween = False
End With
Selection.PageSetup.TextColumns.Add Width:=CentimetersToPoints(15.56), _
Spacing:=CentimetersToPoints(0.37), EvenlySpaced:=False
Selection.PageSetup.TextColumns.Add Width:=CentimetersToPoints(15.63), _
Spacing:=CentimetersToPoints(0.74), EvenlySpaced:=False
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
End Sub
Private Sub CommandButton3_Click()
Selection.InsertBreak Type:=wdSectionBreakNextPage
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=1
.EvenlySpaced = False
.LineBetween = False
End With
Selection.PageSetup.TextColumns.Add Width:=CentimetersToPoints(15.56), _ Spacing:=CentimetersToPoints(0.74), EvenlySpaced:=False
Selection.PageSetup.TextColumns.Add Width:=CentimetersToPoints(3.78), _ Spacing:=CentimetersToPoints(0.37), EvenlySpaced:=False
End Sub
Private Sub OptionButton1_Click()
TextBox5.Visible = False
Label10.Visible = False
End Sub
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
TextBox5.Visible = True
Label10.Visible = True
End If
End Sub
Private Sub OptionButton3_Click()
End Sub
Private Sub OptionButton5_Click()
End Sub
Private Sub TextBox1_Change()
Label11.Visible = False
If TextBox1.Text <> "" Then CommandButton1.Enabled = True Else CommandButton1.Enabled = False
End Sub
Sub d6()
Randomize
Dim a(100) As Integer
Dim l As Integer
Dim ll As Integer
Dim y1 As Integer
Dim xxx As String
name1 = wjm + ".doc"
name2 = "试题" + ".doc"
name3 = "答案" + ".doc"
l = 0
Dim sum As Integer
sum = 0
x1 = 0
y1 = 0
Documents(name1).Activate
ll = ActiveDocument.Paragraphs.Count ActiveDocument.Paragraphs(1).Range.Select n = ts
nn = n
For i = ll To 2 Step -1 ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
For j = 1 To i
If Val(x1) = j Then
y1 = j
GoTo y2:
End If
Next
Next
y2: v1 = Val(TextBox5.Text)
v2 = Int(y1 / ts)
If v1 > v2 Then
MsgBox ("起始题号超限")
Exit Sub
End If
a(1) = v1
For i = 2 To nn
'If v1 > y1 Then
'v1 = a(i) + v2 - nn
'For j = 1 To i
'If a(j) = v1 Then v1 = v1 + 1: Exit For 'Next
'End If
a(i) = v1 + v2
v1 = v1 + v2
Next i
Documents(name2).Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
d3
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Text = bt & Chr(13) & Chr(13)
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Text = bt & Chr(13)
Selection.EndKey Unit:=wdStory
Documents(name1).Activate
j = 1
i = 2
Do While i < ll
ActiveDocument.Paragraphs(i).Range.Select
Set aa = Selection.Words(1)
If Val(aa) >= a(j) Then
ss = 1
f2: Selection.Copy
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
If ss = 1 Then
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "." ss = 0
End If
i = i + 1
If i > ll Then Exit Do
Documents(name1).Activate
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
If Left(Selection.Words.First, 1) <> "/" And cc <> a(j) + 1 Then
GoTo f2:
Else
xxx = xxx & Str(j) & "." & Selection.Words(2).Text
If Right(xxx, 1) = Chr(13) Then
xxx = Left(xxx, Len(xxx) - 1)
End If
f6: Documents(name1).Activate
i = i + 1
If i > ll Then Exit Do
ActiveDocument.Paragraphs(i).Range.Select Set cc = Selection.Words.First
For xz = -1 To 5
If Val(cc) = a(j) + xz Then GoTo xzz: Next
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Paste
GoTo f6:
End If
xzz: j = j + 1
If j > nn Then
Exit Do
End If
Else
i = i + 1
End If
'If j <= nn And i >= ll Then i = 2
Loop
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Text = xxx & Chr(13)
Selection.HomeKey Unit:=wdStory Documents(name1).Save
End Sub
Sub d5()
Randomize
'
Dim a(100) As Integer
Dim l As Integer
Dim ll As Integer
Dim y1 As Integer
Dim sum As Integer
name1 = wjm + ".doc"
name2 = "试题" + ".doc"
name3 = "答案" + ".doc"
l = 0
sum = 0
x1 = 0
y1 = 0
sumn = 0
Documents(name1).Activate
ll = ActiveDocument.Paragraphs.Count ActiveDocument.Paragraphs(1).Range.Select n = Val(TextBox2.Text)
nm = Val(TextBox3.Text)
nn = n
For i = ll To 2 Step -1 ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
For j = 1 To i
If Val(x1) = j Then
y1 = j
x5 = i
GoTo y2:
End If
Next
Next
y2: For i = 2 To x5
ActiveDocument.Paragraphs(i).Range.Select Set bb = Selection.Words(2)
sumn = sumn + Val(bb) * nm
Next
v1 = Val(TextBox5.Text)
v2 = Int(sumn / n)
If v1 > v2 Then
MsgBox (起始题号超限)
Exit Sub
End If
a(1) = v1
l = 1
For i = 2 To y1
'If v1 > y1 Then
'v1 = 1
'If a(1) = v1 Then v1 = v1 + 1
'End If
a(i) = v1 + v2
l = l + 1
v1 = v1 + v2
'If nn > i Then v2 = Int((y1 - v1) / (nn - i))
If v1 > y1 Then Exit For
Next
Documents(name2).Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
d3
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Text = bt & Chr(13) & Chr(13)
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Text = bt & Chr(13)
Selection.EndKey Unit:=wdStory
Documents(name1).Activate
j = 1
i = 2
Do While i < ll
ActiveDocument.Paragraphs(i).Range.Select
Set aa = Selection.Words(1)
If Val(aa) >= a(j) Then
ss = 1
Set bb = Selection.Words(2)
sum = sum + Val(bb) * nm
f2: Selection.Copy
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
If ss = 1 Then
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(2) = "." ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j ss = 0
End If
i = i + 1
If i > ll Then Exit Do
Documents(name1).Activate
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
If Left(Selection.Words.First, 1) <> "/" And cc <> a(j) + 1 Then
GoTo f2:
Else
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Paste
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "." f6: Documents(name1).Activate
i = i + 1
If i > ll Then Exit Do
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
For xz = -1 To 5
If Val(cc) = a(j) + xz Then GoTo xzz:
Next
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Paste
GoTo f6:
End If
xzz: j = j + 1
If j > l Then
Exit Do
End If
Else
i = i + 1
End If
Loop
ksz = nn / (sum / nm)
Label11.Visible = True
Label11.Caption = "填空题每个空的分值: " + Str(ksz)
Selection.HomeKey Unit:=wdStory
Documents(name1).Save
End Sub
Sub d1()
Randomize
'
Dim a(100) As Integer
Dim l As Integer
Dim ll As Integer
Dim y1 As Integer
Dim sum As Integer
name1 = wjm + ".doc"
name2 = "试题" + ".doc"
name3 = "答案" + ".doc"
l = 0
sum = 0
x1 = 0
y1 = 0
sumn = 0
Documents(name1).Activate
ll = ActiveDocument.Paragraphs.Count ActiveDocument.Paragraphs(1).Range.Select n = Val(TextBox2.Text)
nm = Val(TextBox3.Text)
nn = n
For i = ll To 2 Step -1 ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
For j = 1 To i
If Val(x1) = j Then
y1 = j
GoTo sss:
End If
Next
Next
sss: For i = 2 To ll
ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
Set bb = Selection.Words(2)
sumn = sumn + Val(bb) * nm
If x1 = y1 Then Exit For
Next
Documents(name2).Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
d3
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd range2.Text = bt & Chr(13) & Chr(13)
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Text = bt & Chr(13)
Selection.EndKey Unit:=wdStory
Documents(name1).Activate
'For i = ll To 2 Step -1
'ActiveDocument.Paragraphs(i).Range.Select 'Set x1 = Selection.Words(1)
'For j = 1 To i
'If Val(x1) = j Then
'y1 = j
v2 = Int(sumn / nn)
v1 = 1
'GoTo y2:
'End If
'Next
'Next
y2: For i = 1 To y1
a(i) = Int(Rnd * v2) + v1
v1 = v1 + v2
k = 2
Do While k < ll
ActiveDocument.Paragraphs(k).Range.Select Set aa = Selection.Words(1)
If Val(aa) = a(i) Then
Set bb = Selection.Words(2)
sum = sum + Val(bb) * nm
l = l + 1
GoTo f3:
End If
k = k + 1
Loop
f3: If sum >= nn Then GoTo f5:
If v1 >= y1 Then GoTo ff:
Next i
ff: v2 = y1
v1 = 1
For zz = i To y1
f1: a(zz) = Int(Rnd * v2) + v1
For j = 1 To zz - 1
If a(j) = a(zz) Then GoTo f1:
Next j
k = 2
Do While k < ll
ActiveDocument.Paragraphs(k).Range.Select
Set aa = Selection.Words(1)
If Val(aa) = a(zz) Then
Set bb = Selection.Words(2)
sum = sum + Val(bb) * nm
l = l + 1
GoTo fff:
End If
k = k + 1
Loop
fff: If sum >= nn Then GoTo f5:
Next
f5: For i = 1 To l - 1
For j = i + 1 To l
If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t Next j
Next i
j = 1
i = 2
Do While i < ll
ActiveDocument.Paragraphs(i).Range.Select
Set aa = Selection.Words(1)
If Val(aa) >= a(j) Then
ss = 1
f2: Selection.Copy
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
If ss = 1 Then
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(2) = "." ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j
ss = 0
End If
i = i + 1
If i > ll Then Exit Do
Documents(name1).Activate
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
If Left(Selection.Words.First, 1) <> "/" And cc <> a(j) + 1 Then
GoTo f2:
Else
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Paste
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "." f6: Documents(name1).Activate
i = i + 1
If i > ll Then Exit Do
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
For xz = -1 To 5
If Val(cc) = a(j) + xz Then GoTo xzz:
Next
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Paste
GoTo f6:
End If
xzz: j = j + 1
If j > l Then
Exit Do
End If
Else
i = i + 1
End If
Loop
If sum > nn Then
ksz = (sum - nn) / nm
Label11.Visible = True
Label11.Caption = "填空题的空数超过: " + Str(ksz)
End If
Selection.HomeKey Unit:=wdStory
Documents(name1).Save
End Sub
Sub d3()
'
Selection.EndKey Unit:=wdStory
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitContent
Selection.TypeText Text:="得分"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
'Selection.TypeText Text:="批卷人"
Selection.Tables(1).Rows.WrapAroundText = True
Selection.MoveRight Unit:=wdCharacter, Count:=5
Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=35, RulerStyle:= _
wdAdjustNone
Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=35, RulerStyle:= _
wdAdjustNone
' Selection.TypeParagraph
End Sub
Sub d2()
Randomize
Dim a(100) As Integer
Dim l As Integer
Dim ll As Integer
Dim y1 As Integer
Dim xxx As String
name1 = wjm + ".doc"
name2 = "试题" + ".doc"
name3 = "答案" + ".doc"
l = 0
Dim sum As Integer
sum = 0
x1 = 0
y1 = 0
Documents(name2).Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
d3
Documents(name1).Activate
ll = ActiveDocument.Paragraphs.Count ActiveDocument.Paragraphs(1).Range.Select n = ts
nn = n
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd range2.Text = bt & Chr(13) & Chr(13)
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Text = bt & Chr(13)
Selection.EndKey Unit:=wdStory Documents(name1).Activate
For i = ll To 2 Step -1 ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
For j = 1 To i
If Val(x1) = j Then
y1 = j
v2 = Int(y1 / ts)
v1 = 1
GoTo y2:
End If
Next
Next
y2: For i = 1 To nn
f1: a(i) = Int(Rnd * v2) + v1
'For j = 1 To i - 1
'If a(j) = a(i) Then GoTo f1:
'Next j
v1 = v1 + v2
Next i
f5: For i = 1 To nn - 1
For j = i + 1 To nn
If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t
Next j
Next i
j = 1
i = 2
Do While i < ll
ActiveDocument.Paragraphs(i).Range.Select
Set aa = Selection.Words(1)
If Val(aa) >= a(j) Then
ss = 1
f2: Selection.Copy
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
If ss = 1 Then
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "." ss = 0
End If
i = i + 1
If i > ll Then Exit Do
Documents(name1).Activate
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
If Left(Selection.Words.First, 1) <> "/" And cc <> a(j) + 1 Then
GoTo f2:
Else
xxx = xxx & Str(j) & "." & Selection.Words(2).Text
If Right(xxx, 1) = Chr(13) Then
xxx = Left(xxx, Len(xxx) - 1)
End If
f6: Documents(name1).Activate
i = i + 1
If i > ll Then Exit Do
ActiveDocument.Paragraphs(i).Range.Select Set cc = Selection.Words.First
For xz = -1 To 5
If Val(cc) = a(j) + xz Then GoTo xzz: Next
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Paste
GoTo f6:
End If
xzz: j = j + 1
If j > nn Then
Exit Do
End If
Else
i = i + 1
End If
Loop
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Text = xxx & Chr(13)
Selection.HomeKey Unit:=wdStory Documents(name1).Save
End Sub
Sub d11()
Randomize
Dim a(100) As Integer
Dim l As Integer
Dim ll As Integer
Dim y1 As Integer
Dim xxx As String
name1 = wjm + ".doc"
name2 = "试题" + ".doc"
name3 = "答案" + ".doc"
l = 0
Dim sum As Integer
sum = 0
x1 = 0
y1 = 0
Documents(name2).Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
d3
Documents(name1).Activate
ll = ActiveDocument.Paragraphs.Count ActiveDocument.Paragraphs(1).Range.Select n = ts
nn = n
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd range2.Text = bt & Chr(13) & Chr(13)
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd range3.Text = bt & Chr(13)
Selection.EndKey Unit:=wdStory Documents(name1).Activate
For i = ll To 2 Step -1 ActiveDocument.Paragraphs(i).Range.Select Set x1 = Selection.Words(1)
For j = 1 To i
If Val(x1) = j Then
y1 = j
v2 = Int(y1 / ts)
v1 = 1
GoTo y2:
End If
Next
Next
y2: For i = 1 To nn
f1: a(i) = Int(Rnd * v2) + v1
'For j = 1 To i - 1
'If a(j) = a(i) Then GoTo f1:
'Next j
v1 = v1 + v2
Next i
f5: For i = 1 To nn - 1
For j = i + 1 To nn
If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t
Next j
Next i
j = 1
i = 2
Do While i < ll
ActiveDocument.Paragraphs(i).Range.Select
Set aa = Selection.Words(1)
If Val(aa) >= a(j) Then
ss = 1
f2: Selection.Copy
Documents(name2).Activate
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
If ss = 1 Then
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "." ss = 0
End If
i = i + 1
If i > ll Then Exit Do
Documents(name1).Activate
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
If Left(Selection.Words.First, 1) <> "/" And cc <> a(j) + 1 Then
GoTo f2:
Else
Selection.Copy
Documents(name3).Activate
Set range3 = ActiveDocument.Content
range3.Collapse direction:=wdCollapseEnd
range3.Paste
ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count - 1).Range.Words(1) = j & "."
f6: Documents(name1).Activate
i = i + 1
If i > ll Then Exit Do
ActiveDocument.Paragraphs(i).Range.Select
Set cc = Selection.Words.First
For xz = -1 To 5。

相关文档
最新文档