Exceltabelle an Textmarke in Word einfügen
08.12.2003 16:00:15
Lars
hat Jemand eine Idee, wie man aus Excel heraus Tabellen in Word einfügen kann ? Die Tabelle soll an einer bestimmten Textmarke (TabelleEW) eingefügt werden.
Set wdApp = New Word.Application
Set wdDok = wdApp.Documents.Open(ThisWorkbook.Path & "\" & "Gutachten.doc")
wdDok.Windows(1).Activate
wdApp.Visible = True
For Each wdBookmark In wdDok.Bookmarks
MsgBox wdBookmark.name
Select Case wdBookmark.name
Case "TabelleEW"
MsgBox "Tabelle EW wird eingefügt"
wdBookmark.Select
... so weit funktionert alles. Diese Textzeile ist VBA-Code aus Word und funktioniert dort auch wunderbar. Aber aus Excel raus nicht.
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, text:="LINK Excel.Sheet.8 """ & Replace(ThisWorkbook.Path, "\", "\\") & "\\VBA-Standardgutachten.xls"" EW!TabelleEW \a \f 0 \a ", PreserveFormatting:=False
... Normalen Text füg ich ein mit
wdBookmark.Range.InsertAfter "Hier wird die Tabelle eingefügt"
End Select
Next
Vielen Dank im Voraus
Lars