Public
Auswert
As
String
Public
Component
As
String
Public
Component_eintrag1
As
String
Public
Component_eintrag2
As
String
Public
Component_eintrag3
As
String
Sub
Schaltfläche3_Klicken()
Auswert = MsgBox(
"Word-Dokument erstellen?"
, vbYesNo,
"Dokument"
)
If
Auswert = vbNo
Then
MsgBox
"Ok"
Else
Call
Auswertung
End
If
End
Sub
Sub
Auswertung()
MsgBox
"Auswertung 3 ok"
Call
Dokument_öffnen
End
Sub
Sub
Dokument_öffnen()
Component = ActiveSheet.Range(
"B5"
)
Component_eintrag1 = ActiveSheet.Range(
"E5"
)
Component_eintrag2 = ActiveSheet.Range(
"E12"
)
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\Excel Projekt\PLT-3 IQ 2x2-24DC-P wo PKG - 3.dotm"
End
With
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component"
) =
True
Then
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag1"
) =
False
Then
MsgBox
"Felher - Textmarke"
& Component_eintrag1 &
"nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag1"
).Range = Component_eintrag1
If
Doku1.ActiveDocument.Bookmarks.Exists(
"Component_eintrag2"
) =
False
Then
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
MsgBox
"Felher - Textmarke"
& Component_eintrag3 &
"nicht vorhanden"
, vbkOKonly,
"FEHLER"
Else
Doku1.ActiveDocument.Bookmarks(
"Component_eintrag3"
).Range = Component_eintrag3
End
If
End
If
End
If
Else
: MsgBox
"Felher - Textmarke nicht vorhanden"
, vbkOKonly,
"FEHLER"
End
If
End
Sub