插入多值域时要考虑表格行数够不够,不够时要增加表格行数,且每插入一个值,光标要下移一行。这里对应的是数据库的"校核"表。实现的方法如下:
来源:ccidnet 编辑:若水 时间:2008-05-05
收藏:
'插入多值域 Public Function InsertCollection() As Boolean Dim i, j, Count As Integer Dim KeyWord As String Dim mySelection As Selection Dim rec() As Object Dim recCount As Integer
Count = wdDoc.Fields.Count For i = 1 To Count If wdDoc.Fields.Item(i).Type = 81 Then KeyWord = Trim(wdDoc.Fields.Item(i).Data) If Right(KeyWord, 1) = "F" Then KeyWord = Left(KeyWord, Len(KeyWord) - 1) rec = clsDB.GetFieldValues("校核", KeyWord) '选择有域的单元格 wdDoc.Fields.Item(i).Select() mySelection = wdApp.Selection '插入点 mySelection.Cells.Item(1).Select() '清除原值 |