Sub
Dokument_öffnen()
Dim
Constant_Current
As
Variant
Constant_Current = Range(
"C5:C10"
).Value
Dim
Doku1
As
Object
On
Error
Resume
Next
Set
Doku1 = GetObject(,
"Word.Application"
)
If
Doku1
Is
Nothing
Then
Set
Doku1 = CreateObject(
"Word.Application"
)
On
Error
GoTo
0
With
Doku1
.Visible =
True
.Documents.Open
"C:\Users\pby891\Desktop\Testinstruction.dotm"
End
With
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_1"
) =
True
Then
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag1"
) =
False
Then
Component_eintrag1 =
"component_eintrag1"
MsgBox
"Felher - Textmarke "
& Component_eintrag1 &
" nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag1"
).Range =
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag2"
) =
False
Then
Component_eintrag2 =
"component_eintrag2"
MsgBox
"Felher - Textmarke "
& Component_eintrag2 &
" nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag2"
).Range = Component_eintrag2
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag3"
) =
False
Then
Component_eintrag3 =
"component_eintrag3"
MsgBox
"Felher - Textmarke "
& Component_eintrag3 &
" nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag3"
).Range = Component_eintrag3
End
If
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag4"
) =
False
Then
component_eintrag4 =
"component_eintrag4"
MsgBox
"Felher - Textmarke "
& component_eintrag4 &
" nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag4"
).Range = component_eintrag4
End
If
End
If
End
If
Else
: MsgBox
"Felher - Textmarke nicht vorhanden"
, vbkOKonly,
"FEHLER"
End
If
End
Sub