Sub WordNachExcel()
Dim objWordApp As Word.Application
Dim objWordDok As Word.Document
Dim A As Long
Dim strText As Variant
Set objWordApp = New Word.Application
objWordApp.Visible = True
Set objWordDok = objWordApp.Documents.Open(ThisWorkbook.Path & "\Dok1.doc")
For A = 1 To objWordDok.Tables(1).Range.Cells.Count
strText = objWordDok.Tables(1).Range.Cells(A)
strText = Replace(Left$(strText, Len(strText) - 1), Chr(11), Chr(10))
Cells(objWordDok.Tables(1).Range.Cells(A).RowIndex, A) = strText
Next A
Set objWordApp = Nothing
Set objWordDok = Nothing
End Sub
Gruß Tino
Sub WordNachExcel()
Dim objWordApp As Word.Application
Dim objWordDok As Word.Document
Dim Pfad As String
Dim a As Long
Dim strText As Variant
On Error GoTo Fehler:
Application.ScreenUpdating = False
Pfad = _
IIf(Right$(ThisWorkbook.Path, 1) = "\", ThisWorkbook.Path, ThisWorkbook.Path & "\")
Set objWordApp = New Word.Application
objWordApp.Visible = False
Set objWordDok = objWordApp.Documents.Open(Pfad & "Dok1.doc")
With objWordDok.Tables(1).Range
For a = 1 To .Cells.Count
strText = .Cells(a)
strText = Replace(Replace(strText, Chr(7), ""), Chr(13), Chr(10))
If Right$(strText, 1) = Chr(10) Then strText = Left$(strText, Len(strText) - 1)
Cells(.Cells(a).RowIndex, .Cells(a).ColumnIndex) = strText
Next a
End With
Fehler:
On Error Resume Next
objWordDok.Close False
Set objWordApp = Nothing
Set objWordDok = Nothing
Application.ScreenUpdating = True
If Err.Number <> 0 Then MsgBox Err.Description, vbCritical, "Fehler beim lesen!"
End Sub
Gruß Tino