Sub
Transfer_Data()
Dim
xlApp
As
Object
Dim
xlWBook
As
Object
Dim
fld
As
FormField
Dim
nRow
As
Long
Dim
nCol
As
Integer
Set
xlApp = CreateObject(
"excel.Application"
)
xlWBook.Application.Visible =
True
xlWBook.Application.Sheets(
"Geräteübersicht"
).
Select
nRow = xlWBook.Application.Range(
"A65536"
).
End
(xlUp).Row + 1
nCol = 1
nInstall = ActiveDocument.FormFields(
"Gebäude"
).Result
nEqui = ActiveDocument.FormFields(
"EquiNr"
).Result
nTyp = ActiveDocument.FormFields(
"Typ"
).Result
nPTB = ActiveDocument.FormFields(
"PTB"
).Result
nFFS = ActiveDocument.FormFields(
"FFA"
).Result
nSNR = ActiveDocument.FormFields(
"SNR"
).Result
nPMBAR = ActiveDocument.FormFields(
"PMBAR"
).Result
nVMBAR = ActiveDocument.FormFields(
"VMBAR"
).Result
nPVDTNG = ActiveDocument.FormFields(
"PVDTNG"
).Result
nVVDTNG = ActiveDocument.FormFields(
"VVDTNG"
).Result
nMWRKST = ActiveDocument.FormFields(
"MWRKST"
).Result
nProzMed = ActiveDocument.FormFields(
"ProzMed"
).Result
xlWBook.Application.Cells(nRow, 1).Value = ActiveDocument.FormFields(
"Installationsort"
).Result
xlWBook.Application.Cells(nRow, 2).Value = ActiveDocument.FormFields(
"Equipment"
).Result
xlWBook.Application.Cells(nRow, 3).Value = ActiveDocument.FormFields(
"Gerätetyp"
).Result
xlWBook.Application.Cells(nRow, 4).Value = ActiveDocument.FormFields(
"Zulassung"
).Result
xlWBook.Application.Cells(nRow, 5).Value = ActiveDocument.FormFields(
"Filtersatz"
).Result
xlWBook.Application.Cells(nRow, 6).Value = ActiveDocument.FormFields(
"Hersteller-Nr."
).Result
If
ComboBox1.List.Result =
"Armatur funktionssicher instandgesetzt."
Then
xlWBook.Application.Cells(nRow, 7).Value =
"OK"
ElseIf
ComboBox1.List.Result =
"Weitere Maßnahmen erforderlich. (siehe Text)"
Then
xlWBook.Application.Cells(nRow, 7).Value =
"Beanstandet"
Else
xlWBook.Application.Cells(nRow, 7).Value =
"Keine Wartung"
End
If
xlWBook.Application.Cells(nRow, 8).Value = ActiveDocument.FormFields(
"Druck"
).Result
xlWBook.Application.Cells(nRow, 9).Value = ActiveDocument.FormFields(
"Vakuum"
).Result
xlWBook.Application.Cells(nRow, 10).Value = ActiveDocument.FormFields(
"Ü-Druck Dichtung"
).Result
xlWBook.Application.Cells(nRow, 11).Value = ActiveDocument.FormFields(
"U-Druck Dichtung"
).Result
xlWBook.Application.Cells(nRow, 12).Value = ActiveDocument.FormFields(
"Membran"
).Result
xlWBook.Application.Cells(nRow, 13).Value = ActiveDocument.FormFields(
"Prozessmedium"
).Result
ActiveDocument.Protect (wdAllowOnlyFormFields)
ActiveDocument.Fields(1).
Select
xlWBook.Close savechanges:=
True
ActiveDocument.FormFields(
"Installationsort"
).Result = nInstall
ActiveDocument.FormFields(
"Equipment"
).Result = nEqui
ActiveDocument.FormFields(
"Gerätetyp"
).Result = nTyp
ActiveDocument.FormFields(
"Zulassung"
).Result = nPTB
ActiveDocument.FormFields(
"Filtersatz"
).Result = nFFS
ActiveDocument.FormFields(
"Hersteller-Nr."
).Result = nSNR
ComboBox1.List.Result = nStatus
ActiveDocument.FormFields(
"Druck"
).Result = nPMBAR
ActiveDocument.FormFields(
"Vakuum"
).Result = nVMBAR
ActiveDocument.FormFields(
"Ü-Druck Dichtung"
).Result = nPVDTNG
ActiveDocument.FormFields(
"U-Druck Dichtung"
).Result = nVVDTNG
ActiveDocument.FormFields(
"Membran"
).Result = nMWRKST
ActiveDocument.FormFields(
"Prozessmedium"
).Result = nProzMed
End
Sub