I have a number of word documents which I need to extract information from. I found code to do it with a text document, but I can't figure out how to apply the same logic to a .docx file.

Any ideas?

Word 2010 macro:
Code:
Sub search()
'
' search Macro
' look for a value and output to a file
'
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("file location")

Do Until objFile.AtEndOfStream
    strData = ""
    strSearchString = objFile.ReadLine

    intStart = InStr(strSearchString, "KEYWORD")

    If intStart <> 0 Then
        intStart = intStart + (length of keyword)
        strText = Mid(strSearchString, intStart, 250)

        For i = 1 To Len(strText)
            If Mid(strText, i, 1) = " " Then
                Exit For
            Else
                strData = strData & Mid(strText, i, 1)
                
            End If
            
            
        Next
    End If
    
Loop

Selection.TypeText Text:=strData


End Sub