What you are not understanding is that there is only one of each content controls in the document i.e. Item(1), no matter how many tables there are, and they are not where you might suspect. This can easily be demonstrated with your test document and the following Word macro
Sub Macro1()
Dim oCC As ContentControl
Set oCC = ActiveDocument.SelectContentControlsByTitle("ValueA").Item(1)
oCC.Range.Font.ColorIndex = wdRed
Set oCC = ActiveDocument.SelectContentControlsByTitle("ValueB").Item(1)
oCC.Range.Font.ColorIndex = wdRed
Set oCC = ActiveDocument.SelectContentControlsByTitle("ValueC").Item(1)
oCC.Range.Font.ColorIndex = wdRed
Set oCC = ActiveDocument.SelectContentControlsByTitle("ValueD").Item(1)
oCC.Range.Font.ColorIndex = wdRed
End Sub
You therefore need a different approach e.g.
Sub getWordFormData()Dim wdApp As Object, myDoc As Object, oCC As Object
Dim myFolder As String, strFile As String
Dim i As Long, j As Long
myFolder = "D:\"
If Len(Dir(myFolder)) = 0 Then
MsgBox myFolder & vbCrLf & "Not Found", vbInformation, "Cancelled - getWordFormData"
Exit Sub
End If
Application.ScreenUpdating = False
Set wdApp = CreateObject("Word.Application")
With ActiveSheet
.Cells.Clear
With .Range("A1:D1")
.value = Array("ValueA", "ValueB", "ValueC", "ValueD")
.Font.Bold = True
End With
strFile = Dir(myFolder & "testfile.docx", vbNormal) 'There will only be one testfile.docx in that folder?
i = 0 'Change to 0
While strFile <> ""
i = i + 1
Set myDoc = wdApp.Documents.Open(FileName:=myFolder & "\" & strFile, ReadOnly:=True, AddToRecentFiles:=False, Visible:=False)
For j = 1 To myDoc.Tables.Count 'Loop throughout the tables
For Each oCC In myDoc.Tables(j).Range.ContentControls 'loop through the content controls in the table
Select Case oCC.Title
Case Is = "ValueA"
.Cells(i + j, 1).value = oCC.Range.Text
Case Is = "ValueB"
.Cells(i + j, 2).value = oCC.Range.Text
Case Is = "ValueC"
.Cells(i + j, 3).value = oCC.Range.Text
Case Is = "ValueD"
.Cells(i + j, 4).value = oCC.Range.Text
End Select
Next oCC
Next j
myDoc.Close SaveChanges:=False
strFile = Dir()
Wend
wdApp.Quit
Application.ScreenUpdating = True
End With
Set myDoc = Nothing
Set oCC = Nothing
Set wdApp = Nothing
End Sub