Sub WordToExcel()
    Dim docFilename As Object, wordApp As Object
    Dim i As Integer, j As Integer, k As Integer
    On Error GoTo Thoat
    Dim FilePath, Arr(), iRow As Integer
    FilePath = Application.GetOpenFilename("Word Files (*.doc*), *.doc*")
    If FilePath <> False Then
        iRow = Sheet1.Range("A10000").End(xlUp).Row + 1
        Sheet1.Rows("2:" & iRow).Delete
        Set wordApp = CreateObject("Word.Application")
            Set docFilename = wordApp.documents.Open(FilePath)
            For i = 2 To docFilename.Tables.Count
                With docFilename.Tables(i)
                    If .Rows.Count > 1 Then
                        ReDim Arr(1 To .Columns.Count - 1, 1 To .Rows.Count)
                        For k = 2 To .Columns.Count
                            Arr(k - 1, 1) = Left(.cell(1, k), Len(.cell(1, k)) - 1)
                        Next k
                        For j = 2 To .Rows.Count
                            For k = 2 To .Columns.Count
                                Arr(k - 1, j) = Left(.cell(j, k), Len(.cell(j, k)) - 1)
                            Next k
                        Next j
                        iRow = Sheet1.Range("A10000").End(xlUp).Row + 1
                        Sheet1.Range("A" & iRow).Resize(.Columns.Count - 1, .Rows.Count).Value = Arr
                    End If
                End With
            Next i
            docFilename.Close True
            Set docFilename = Nothing
        Set wordApp = Nothing
        MsgBox "Da thuc hien xong", , "---GPE---"
    End If
    Exit Sub
Thoat:
        docFilename.Close False
        Set docFilename = Nothing
    Set wordApp = Nothing
    MsgBox "Da co loi xu ly", , "---GPE---"
End Sub