因单位要求,帮镇工会组织的“2008迎奥运,计算机操作竞赛”出试题。主要内容有打字、Word操作、Excel操作和PPT操作。由于参加竞赛的人员较多,不可能为每一位选手手工评分,所以用Office中的VBA来实现各个模块试题的自动评分。现将各部分操作题目及VBA程序贴出。
Word试题:
href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" rel="File-List" />
以下是评分的VBA代码:
Score = 0
'//No 1 共 6 分
If ActiveDocument.Paragraphs(2).Range.Font.Color = wdColorBlue Then Score = Score + 2
If ActiveDocument.Paragraphs(2).Range.Font.NameFarEast = "黑体" Then Score = Score + 2
If ActiveDocument.Paragraphs(2).Range.Font.Size = 42 Then Score = Score + 2
'MsgBox (ActiveDocument.Paragraphs(7).Range.Font.Size)
'//No 2 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(56).Font.Underline = wdUnderlineWavy _
And ActiveDocument.Paragraphs(3).Range.Characters(63).Font.Underline = wdUnderlineWavy Then
Score = Score + 4
End If
'//No 3 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).LineStyle = wdLineStyleSingle _
And ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).LineWidth = wdLineWidth050pt _
And ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).Color = wdColorRed Then
If ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).LineStyle = wdLineStyleSingle _
And ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).LineWidth = wdLineWidth050pt _
And ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).Color = wdColorRed Then
Score = Score + 4
End If
End If
'//No 4 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(71).Font.Shading.Texture = wdTexture20Percent _
And ActiveDocument.Paragraphs(3).Range.Characters(71).Font.Shading.BackgroundPatternColor = wdColorGreen Then
If ActiveDocument.Paragraphs(3).Range.Characters(77).Font.Shading.Texture = wdTexture20Percent _
And ActiveDocument.Paragraphs(3).Range.Characters(77).Font.Shading.BackgroundPatternColor = wdColorGreen Then
Score = Score + 4
End If
End If
'//No 5 共 4 分
On Error Resume Next
shp = ActiveDocument.InlineShapes(2).Height
If Err <> 0 Then
Score = Score
Else
Score = Score + 2
If ActiveDocument.InlineShapes(2).Height = 169.8 And _
ActiveDocument.InlineShapes(2).Width = 283.25 Then
Score = Score + 2
End If
End If
'// No 6 共4分
If ActiveDocument.Paragraphs(4).DropCap.Position = wdDropNormal And _
ActiveDocument.Paragraphs(4).DropCap.LinesToDrop = 2 Then
Score = Score + 2
End If
If ActiveDocument.Paragraphs(4).DropCap.FontName = "隶书" Then
Score = Score + 2
End If
'// No 7 共6分
If ActiveDocument.Paragraphs(5).Range.Font.NameFarEast = "宋体" And _
ActiveDocument.Paragraphs(6).Range.Font.NameFarEast = "宋体" And _
ActiveDocument.Paragraphs(7).Range.Font.NameFarEast = "宋体" Then
Score = Score + 2
End If
If ActiveDocument.Paragraphs(5).Range.Font.Size = 12 And _
ActiveDocument.Paragraphs(6).Range.Font.Size = 12 And _
ActiveDocument.Paragraphs(7).Range.Font.Size = 12 Then
Score = Score + 2
End If
'wdLineSpace1pt5
If ActiveDocument.Paragraphs(5).Range.ParagraphFormat.LineSpacingRule = 1 And _
ActiveDocument.Paragraphs(6).Range.ParagraphFormat.LineSpacingRule = 1 And _
ActiveDocument.Paragraphs(7).Range.ParagraphFormat.LineSpacingRule = 1 Then
Score = Score + 2
End If
'MsgBox (ActiveDocument.Paragraphs(5).Range.Characters(2).Text)
'MsgBox (ActiveDocument.Paragraphs(6).Range.Characters(2).Text)
'MsgBox (ActiveDocument.Paragraphs(7).Range.Characters(2).Text)
'MsgBox (ActiveDocument.l)
MsgBox ("你的分数是: " & Score)
End If
Word试题:
href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" rel="File-List" />
澳门概况
澳门面向辽阔的海洋,背靠珠江三角洲和西江中下游宽广的腹地,又与香港、广州两大城市及珠海
、深圳两面经济特区为邻
,这样好的地理位置对它的经济发展起到了重要作用。
两座澳凼大桥在烟波浩渺的南海水面凌空飞架,将澳门半岛和凼仔岛连接在一起。一条填海建成的连贯公路像一个人的两只手,一手,一手拉着凼仔岛,一手牵着路环岛。原来只能隔海相望的半岛和两个离岛通过两座大桥和一条公路全都连在一起。
第3段:澳门的面积很小(25.8平方千米),是世界上人口最稠密的地方之一,也是亚洲人均收入比较高的地区。
第4段:澳门是一个国际化的都市,几百年来,一直是中西文化融和共存的地方。
第5段:澳门位於中国东南沿海的珠江三角洲,在东经113’ 35’ 北纬22’ 14’, 与东北偏东的香港相约六十公里。
澳门图片
Word
操作题:
(
共
32
分
)
(1)
将标题设置黑体、初号、蓝色(6分)
(2)
设置“这样好的地理位置”加波浪下划线(4分)
(3)
设置“对它的经济发展”加红色边框(4分)
(4)
设置“起到了重要作用”加绿色、
20%
底纹。(4分)
(5)将考试文件夹中的“pic.jpg”插入到“澳门图片”下面,并且
设置文中图片:高
6
厘米
,宽
10
厘米
(
4
分)
(6)设置第二段首字下沉:下沉二行、隶书 (4分)
(7)由于第3、4、5段是网上下载,其带有一些文字段落格式,例如不规则的段落行距,下划线等,请将其格式去除,并设置第3、4、5段格式:(6分)
行距:1.5倍行距,
字体:小四、宋体
去掉第4段下面的横线
以下是评分的VBA代码:
Score = 0
'//No 1 共 6 分
If ActiveDocument.Paragraphs(2).Range.Font.Color = wdColorBlue Then Score = Score + 2
If ActiveDocument.Paragraphs(2).Range.Font.NameFarEast = "黑体" Then Score = Score + 2
If ActiveDocument.Paragraphs(2).Range.Font.Size = 42 Then Score = Score + 2
'MsgBox (ActiveDocument.Paragraphs(7).Range.Font.Size)
'//No 2 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(56).Font.Underline = wdUnderlineWavy _
And ActiveDocument.Paragraphs(3).Range.Characters(63).Font.Underline = wdUnderlineWavy Then
Score = Score + 4
End If
'//No 3 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).LineStyle = wdLineStyleSingle _
And ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).LineWidth = wdLineWidth050pt _
And ActiveDocument.Paragraphs(3).Range.Characters(64).Font.Borders(1).Color = wdColorRed Then
If ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).LineStyle = wdLineStyleSingle _
And ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).LineWidth = wdLineWidth050pt _
And ActiveDocument.Paragraphs(3).Range.Characters(70).Font.Borders(1).Color = wdColorRed Then
Score = Score + 4
End If
End If
'//No 4 共 4 分
If ActiveDocument.Paragraphs(3).Range.Characters(71).Font.Shading.Texture = wdTexture20Percent _
And ActiveDocument.Paragraphs(3).Range.Characters(71).Font.Shading.BackgroundPatternColor = wdColorGreen Then
If ActiveDocument.Paragraphs(3).Range.Characters(77).Font.Shading.Texture = wdTexture20Percent _
And ActiveDocument.Paragraphs(3).Range.Characters(77).Font.Shading.BackgroundPatternColor = wdColorGreen Then
Score = Score + 4
End If
End If
'//No 5 共 4 分
On Error Resume Next
shp = ActiveDocument.InlineShapes(2).Height
If Err <> 0 Then
Score = Score
Else
Score = Score + 2
If ActiveDocument.InlineShapes(2).Height = 169.8 And _
ActiveDocument.InlineShapes(2).Width = 283.25 Then
Score = Score + 2
End If
End If
'// No 6 共4分
If ActiveDocument.Paragraphs(4).DropCap.Position = wdDropNormal And _
ActiveDocument.Paragraphs(4).DropCap.LinesToDrop = 2 Then
Score = Score + 2
End If
If ActiveDocument.Paragraphs(4).DropCap.FontName = "隶书" Then
Score = Score + 2
End If
'// No 7 共6分
If ActiveDocument.Paragraphs(5).Range.Font.NameFarEast = "宋体" And _
ActiveDocument.Paragraphs(6).Range.Font.NameFarEast = "宋体" And _
ActiveDocument.Paragraphs(7).Range.Font.NameFarEast = "宋体" Then
Score = Score + 2
End If
If ActiveDocument.Paragraphs(5).Range.Font.Size = 12 And _
ActiveDocument.Paragraphs(6).Range.Font.Size = 12 And _
ActiveDocument.Paragraphs(7).Range.Font.Size = 12 Then
Score = Score + 2
End If
'wdLineSpace1pt5
If ActiveDocument.Paragraphs(5).Range.ParagraphFormat.LineSpacingRule = 1 And _
ActiveDocument.Paragraphs(6).Range.ParagraphFormat.LineSpacingRule = 1 And _
ActiveDocument.Paragraphs(7).Range.ParagraphFormat.LineSpacingRule = 1 Then
Score = Score + 2
End If
'MsgBox (ActiveDocument.Paragraphs(5).Range.Characters(2).Text)
'MsgBox (ActiveDocument.Paragraphs(6).Range.Characters(2).Text)
'MsgBox (ActiveDocument.Paragraphs(7).Range.Characters(2).Text)
'MsgBox (ActiveDocument.l)
MsgBox ("你的分数是: " & Score)
End If