我有4列,每列有2組複選框,我正在尋找循環遍歷每個集合,並檢查兩個複選框是否都被選中,如果它們然後退出子集並且將該項目的名稱與在msgbox中的一組中選中的2個複選框進行檢查。在Word中循環表格並檢查複選框是否勾選
Set oRow = oTable.Rows
Set oTable = doc.Tables(3)
For Each oRow In oTable.Rows
With oRow
If .Cells(3).Range.Text <> .Cells(3).Range.Text <> "Prep" Or .Cells(3).Range.Text <> "Y" Or .Cells(3).Range.Text <> "" Then
If .Cells(3).ParentContentControl.Checked = True And .Cells(4).ParentContentControl.Checked = True Then 'error here
MsgBox "The following item has both preparer and reviewer checked:" & .Cells(2)
Exit Sub
ElseIf .Cells(5).ParentContentControl.Checked = True And .Cell(6).ParentContentControl.Checked = True Then
MsgBox .Cell(2)
Exit Sub
End If
End If
End With
Next oRow
的問題是我不斷收到一個錯誤。
運行時錯誤「438」,對象不支持此屬性或方法。
什麼樣的錯誤? –
運行時錯誤'438',對象不支持此屬性或方法。 – Lowpar
你有什麼樣的複選框,它是'ContentControl'還是'Field'?您能否添加文檔的該部分的屏幕截圖以便更好地理解? –