Vba Code Beispiel:
mit Excel ein Word Dokument lesen.
In Word Makro ist der Code :
Dim
app_Word As New Word.Application
Dim doc As
Word.Document
Set doc =
app_Word.Documents.Open(sWord_Filepath,
ReadOnly:=True, Visible:=False)
doc.Content.Copy
Dim cell As
Range
Set cell =
ActiveSheet.Range("C14")
cell.PasteSpecial xlPasteAll
Option Explicit On
Private Const iColumn_Senden As Integer = 2
Private Const iColumn_Anhang As Integer = 5
'===================< Region: Email
>===================
Public Sub Button_Read_Word_File()
'-------------<
Button_Read_Word_File() >-------------
'*Open and
Read Word File in same Folder
'-<
init >-
Dim sPath As String
sPath = Application.ActiveWorkbook.Path
Dim sWord_Filepath As String
sWord_Filepath = sPath & "\" & "Text_for_Excel.docx"
'-</
init >-
Dim app_Word As New Word.Application
Dim doc As Word.Document
Set doc =
app_Word.Documents.Open(sWord_Filepath, ReadOnly:=True, Visible:=False)
'< copy
word content >
doc.Content.Copy
Dim cell As Range
Set cell = ActiveSheet.Range("C14")
cell.PasteSpecial xlPasteAll
'</
copy word content >
'<
close word >
doc.Close SaveChanges:=False
'</
close word >
'-------------</
Button_Read_Word_File() >-------------
End Sub
|