Sub
AnschreibenGutachtenNeu()
Dim
strFileName
As
String
Dim
objWDApp
As
Object
Dim
objDocx
As
Object
Dim
xlZelle
As
Range
strFileName =
"C:\Users\Christopher Goihl\Documents\Spaces\Bea und Chris\Projekt Makro\tester.docx"
If
Dir(strFileName) =
""
Then
MsgBox
"Datei "
""
& strFileName &
""
" nicht gefunden!"
Exit
Sub
End
If
ActiveCell.SpecialCells(xlLastCell).
Select
With
ActiveSheet
Set
xlZelle = .Cells(ActiveCell.Row, 1)
End
With
Application.ScreenUpdating =
False
If
objWDApp
Is
Nothing
Then
Set
objWDApp = CreateObject(
"Word.Application"
)
bolWordLiefNicht =
True
End
If
Set
objWDApp = CreateObject(
"Word.Application"
)
objWDApp.Visible =
True
Set
objDocx = objWDApp.Documents.Open(strFileName,
ReadOnly
:=
False
)
objDocx.Bookmarks(
"Aktenzeichen"
).Range.Text = xlZelle.Offset(0, 6).Text
Application.ScreenUpdating =
True
End
Sub