Private
Sub
CommandButton1_Click()
On
Error
GoTo
Fehler
Dim
ref
On
Error
Resume
Next
Set
ref = Application.VBE.ActiveVBProject.References.AddFromGuid(
"{00020905-0000-0000-C000-000000000046}"
, 0, 0)
Dim
WordApp
As
Object
Set
WordApp = CreateObject(
"Word.Application"
)
WordApp.Visible =
True
WordApp.Application.Documents.Open
"C:\Desktop\Test.dot"
Worksheets(1).Range(Cells(3, 1), Cells(85, 9)).Copy
If
WordApp.activedocument.Bookmarks.Exists(
"I"
)
Then
Dim
meinBM
Set
meinBM = WordApp.activedocument.Bookmarks(
"I"
).Range
meinBM.Paste
Else
MsgBox
"Die Textmarke [I] ist nicht vorhanden"
Exit
Sub
End
If
WordApp.Application.Activate
Exit
Sub
Fehler: MsgBox
"Word Dokument wurde nicht gefunden!"
WordApp.Quit
End
Sub