Excel zu Word
17.05.2006 14:54:09
Bernd
Selection.Copy
.Range("a4").Select
Dim word As Object
Dim text_marke As String
Set word = CreateObject("Word.application")
word.Visible = True
'Vorlage laden funktioniert.
word.documents.Add template:="C:\angebot.dot"
With word.activeDocument
' In der Textvorlage ist eine Textmarke "tabelle" abgespeichert. An diese Position soll die Tabelle aus der Zwischenablage eingefügt werden. Ich habs mit dem Macrorecorder in Word probiert.
' Dieser Code ist dabei rausgekommen. Bleibt aber schon in der ersten Codezeile
'hängen. Wie mach ich es richtig?
Selection.Goto ToBookmark, name:="tabelle"
Selection.Find.ClearFormatting
With Selection.Find
.text = ""
.Replacement.text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.PasteExcelTable False, False, False
End With