欢迎来到天天文库
浏览记录
ID:34394870
大小:70.01 KB
页数:12页
时间:2019-03-05
《vb自动生成格式试卷代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、vb自动生成word格式试卷代码DimTempRec1AsNewADODB.RecordsetDimA1AsString'DimMyWordAsWord.ApplicationDimWordDocAsWord.DocumentDimBTextBoxDimMyRangeAsWord.RangeDimMyTableAsWord.TableDimMyCellAsWord.CellDimMyCellsAsWord.CellsDimMyColsAsWord.ColumnsDimA()AsStringDimB()AsStringDimColNAsInt
2、egerDimArrBytes()AsByteDimFreeFileNumberAsIntegerDimLngsizeAsLongSetTempRec1.ActiveConnection=DBConIfCombo1.ListIndex=-1ThenMsgBox"没有选择试卷名称,不能生成试卷!",vbOKOnly,"提示"ExitSubEndIfTempRec1.Open"selectidfromsjtxwheresjbm='"&SjbmArry(Combo1.ListIndex+1)&"'"IfTempRec1.RecordCount=0
3、ThenMsgBox"没有选择试卷题型顺序,不能生成试卷!",vbOKOnly,"提示"ExitSubEndIfTempRec1.CloseLoadForm13Form13.Height=810Form13.Width=4680CenterFormForm13,MDIForm1Form13.ShowMe.Enabled=False'创建新文档OnErrorGoToErrorEndStart:SetWordDoc=MyWord.Documents.AddIfOption1.ValueThenWithWordDoc.PageSetup.Page
4、Height=InchesToPoints(11.69).PageWidth=InchesToPoints(8.27)EndWithEndIfIfOption2.ValueThen'试卷分栏设置WordDoc.PageSetup.TogglePortraitWithWordDoc.PageSetup.PageHeight=InchesToPoints(11.69).PageWidth=InchesToPoints(16.54)EndWithWordDoc.PageSetup.TextColumns.SetCountNumColumns:=2
5、WordDoc.PageSetup.TextColumns.Spacing=CentimetersToPoints(4)EndIf'插入试卷名称MyWord.Selection.Font.Name="宋体"MyWord.Selection.Font.Size=16A1$=Trim(Combo1.Text)MyWord.Selection.ParagraphFormat.Alignment=wdAlignParagraphCenterMyWord.Selection.TypeTextA1$MyWord.Selection.TypeTextCh
6、r(13)'插入科目名称MyWord.Selection.Font.Name="宋体"MyWord.Selection.Font.Size=15A1$="《"&Trim(Combo2.Text)&"》"+Chr(13)MyWord.Selection.Font.Bold=TrueMyWord.Selection.ParagraphFormat.Alignment=wdAlignParagraphCenterMyWord.Selection.TypeTextA1$MyWord.Selection.Font.Bold=False'插入注意事项I
7、fTempRec1.State=1ThenTempRec1.CloseEndIfTempRec1.Open"selectZysxfromSjbtwhereSjbm='"&SjbmArry(Combo1.ListIndex+1)&"'"IfTempRec1.RecordCount=0ThenMsgBox"没有找到试卷的注意事项,不能生成试卷!",vbOKOnly,"提示"GoToErrorEndEndIfA1$=TempRec1.Fields("Zysx").ValueMyWord.Selection.Font.Name="黑体"MyWord
8、.Selection.Font.Size=10.5MyWord.Selection.ParagraphFormat.Alignment=wdAlignParagraphLeftM
此文档下载收益归作者所有