|
本帖最后由 duquancai 于 2016-10-3 13:28 编辑
代码放入ThisDocument中,详见附件》》》》》》》》》》- Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
- Dim c As Cell
- On Error Resume Next
- With ThisDocument.ContentControls(1)
- .DropdownListEntries.Clear
- For Each c In ActiveDocument.Tables(1).Columns(1).Cells
- .DropdownListEntries.Add Split(c.Range, Chr(13))(0)
- Next
- End With
- With ThisDocument
- For i = 3 To 6
- .ContentControls(i).DropdownListEntries.Clear
- Next
- .ContentControls(8).DropdownListEntries.Clear
- For Each c In ActiveDocument.Tables(1).Columns(1).Cells
- If .ContentControls(1).Range.Text = Split(c.Range, Chr(13))(0) Then
- .ContentControls(3).DropdownListEntries.Add Split(c.Row.Cells(2).Range, Chr(13))(0)
- .ContentControls(4).DropdownListEntries.Add Split(c.Row.Cells(3).Range, Chr(13))(0)
- .ContentControls(5).DropdownListEntries.Add Split(c.Row.Cells(3).Range, Chr(13))(0)
- .ContentControls(6).DropdownListEntries.Add Split(c.Row.Cells(1).Range, Chr(13))(0)
- .ContentControls(8).DropdownListEntries.Add Split(c.Row.Cells(2).Range, Chr(13))(0)
- End If
- Next
- End With
- End Sub
复制代码
|
|