Private
Sub
button_exit_Click()
Dim
LastRow
As
Long
, ws
As
Worksheet
Set
ws = Sheets(
"Tabelle1"
)
LastRow = ws.Range(
"A"
& Rows.Count).
End
(xlUp).Row + 1
ws.Range(
"A"
& LastRow).Value = mandant
ws.Range(
"A"
& LastRow).Offset(0, 1).Value = projekttyp
ws.Range(
"A"
& LastRow).Offset(0, 2).Value = datum
ws.Range(
"A"
& LastRow).Offset(0, 3).Value = datum_ende
ws.Range(
"A"
& LastRow).Offset(0, 4).Value = mandant_ort
ws.Range(
"A"
& LastRow).Offset(0, 5).Value = team
ws.Range(
"A"
& LastRow).Offset(0, 7).Value = eingesparteskapital
ws.Range(
"A"
& LastRow).Offset(0, 8).Value = vermiedenekosten
ws.Range(
"A"
& LastRow).Offset(0, 9).Value = subventionen
ws.Range(
"A"
& LastRow).Offset(0, 10).Value = marktanteil
ws.Range(
"A"
& LastRow).Offset(0, 11).Value = investitioninfra
UserForm2.Show
Dim
wrdApp
As
Word.Application
Dim
wrdDoc
As
Word.Document
Dim
i
As
Integer
Set
wrdApp = CreateObject(
"Word.Application"
)
wrdApp.Visible =
False
Set
wrdDoc = wrdApp.Documents.Add
With
wrdDoc
.Content.Font.NameAscii =
"Century Gothic"
.Content.Font.Size = 10
.Content.Font.Bold =
True
.Content.Font.TextColor = RGB(0, 70, 70)
.Content.InsertAfter (
"Vom "
& datum &
" bis zum "
& datum_ende &
" haben Wir eine "
& projekttyp &
" mit "
& mandant &
" durchgeführt."
)
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Dies ist ein Test der UserForm, mit der ein Bericht exportiert werden kann. Es folgen Werte, die über die Eingabemaske in das Excelsheet aufgenommen wurden."
)
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Eingespartes Kapital:"
& vbTab & eingesparteskapital)
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Vermiedene Kosten:"
& vbTab & vermiedenekosten)
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Subventionen:"
& vbTab & subventionen)
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Erhöhung des Marktanteils:"
& vbTab & marktanteil)
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
.Content.InsertAfter (
"Investitionen in örtliche Infrastruktur:"
& vbTab & investitioninfra)
End
With
MkDir ThisWorkbook.Path &
"/"
& mandant
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
ThisWorkbook.Path &
"/"
& mandant &
"/"
& Umlaut(projekttyp) &
"_"
& datumtag & datummonat & datumjahr &
".pdf"
, ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=
False
, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1,
To
:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=
True
, KeepIRM:=
True
, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=
True
, _
BitmapMissingFonts:=
True
, UseISO19005_1:=
False
wrdApp.Visible =
True
wrdApp.Quit
False