|
- Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
- If StrComp(ContentControl.Tag, "名字", vbTextCompare) = 0 Then
- Dim tblSource As Word.Table
- Dim oCell As Word.Cell
- Set tblSource = Me.Tables(1)
- For Each oCell In tblSource.Columns(1).Cells
- If StrComp(Me.ContentControls(1).Range.Text, Split(oCell.Range.Text, Chr(13))(0), vbTextCompare) = 0 Then
- Me.ContentControls(2).Range.Text = Replace$(oCell.Row.Cells(2).Range.Text, Chr$(13) & Chr$(7), Empty)
- Me.ContentControls(3).Range.Text = Replace$(oCell.Row.Cells(3).Range.Text, Chr$(13) & Chr$(7), Empty)
- Me.ContentControls(4).Range.Text = Replace$(oCell.Row.Cells(4).Range.Text, Chr$(13) & Chr$(7), Empty)
- Exit Sub
- Else
- Me.ContentControls(2).Range.Text = "Unknow"
- Me.ContentControls(3).Range.Text = "Unknow"
- Me.ContentControls(4).Range.Text = "Unknow"
- End If
- Next
- End If
- End Sub
复制代码 |
|