Sub
AutoOpen()
Dim
dname
As
String
dname = ActiveDocument.Name
If
dname =
"DTS2.0_MASTER.dotm"
Then
UserForm2.Show
Else
UserForm3.Show
End
If
End
Sub
...
Private
Sub
CommandButton1_Click()
UserForm2.Hide
UserForm1.Show
End
Sub
Private
Sub
CommandButton2_Click()
UserForm2.Hide
MsgBox
"Das Dokument wird geschlossen."
ActiveDocument.Close
End
Sub
...
Sub
Neues_Projekt()
Type_No = InputBox(
"Bitte geben Sie den Produkt-Typ im folgenden Format ein: XXXX!"
,
"Bitte Produkt-Typ eingeben"
)
If
Type_No =
""
Then
MsgBox
"Vorgang abgebrochen! Das aktive Dokument wird geschlossen."
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Exit
Sub
End
If
If
MsgBox(
"Handelt es sich bei Ihrem Produkt-Typ um eine Standard-Variante? (bzw. NICHT um eine Sondervariante (Clamp / ATEX / ...)?"
, vbYesNo) = vbNo
Then
Type_Name = InputBox(
"Bitte geben Sie die Produkt-Variante im folgenden Format ein: Tube_Valve_Body / Weld / ATEX / ...!"
,
"Bitte Produkt-Variante eingeben"
)
If
Type_Name =
""
Then
MsgBox
"Vorgang abgebrochen! Das aktive Dokument wird geschlossen."
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Exit
Sub
End
If
Else
Type_Name =
"Standard"
End
If
Dim
Datum
As
String
Dim
Path
As
String
Dim
Path1
As
String
Dim
Path2
As
String
Dim
Path3
As
String
Dim
Path4
As
String
Datum = Format(
Date
,
"yyyymmdd"
)
Path =
"\\BURKERT\Marketing\DataSheetReview\1_PROJEKTE\" + Type_No + "
_" + Type_Name
Path1 = Path +
"\1_LATEST_VERSION_WORD"
Path2 = Path +
"\2_LATEST_VERSION_PDF"
Path3 = Path +
"\3_FILES"
Path4 = Path +
"\4_PREV_VERSIONS_WORD"
If
Dir(Path, vbDirectory) =
""
Then
MkDir (Path)
MkDir (Path1)
MkDir (Path2)
MkDir (Path3)
MkDir (Path4)
MsgBox
"Ein Projekt-Ordner f¸r das gew¸nschte Projekt wurde automatisch angelegt!"
Else
MsgBox
"Ein entsprechender Projekt-Ordner ist bereits vorhanden! Bitte pr¸fen Sie eventuelle Dubletten oder w‰hlen Sie einen anderen Namen!"
MsgBox
"Vorgang abgebrochen! Das aktive Dokument wird geschlossen."
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Exit
Sub
End
If
Dim
Editor_name
As
String
Editor_name = InputBox(
"Bitte geben Sie Ihren Namen im folgenden Format ein: NameVorname!"
,
"Bitte Ihren Namen eingeben"
)
If
Editor_name =
""
Then
MsgBox
"Vorgang abgebrochen! Das aktive Dokument wird geschlossen."
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Exit
Sub
End
If
Dim
DocName
As
String
DocName =
"DS"
& Type_No &
"_"
& Type_Name &
"_"
&
"ENTWURF"
&
"_"
& Format(
Date
,
"yyyymmdd"
) &
"_"
& Editor_name &
".docm"
DocName2 = Path1 + "\" + DocName
Dim
strPfad
As
String
strPfad = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = Path1
With
Dialogs(wdDialogFileSaveAs)
.Name = DocName2
.Format = Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled
.Show
End
With
ActiveDocument.Save
MsgBox
"Sie kˆnnen nun mit der Bearbeitung des Dokuments beginnen. Editieren Sie das Dokument wie gew¸nscht."
& vbNewLine &
"Die Datei wurde automatisch im Unterordner 1_LATEST_VERSION_WORD des Projektordners abgelegt."
& vbNewLine &
"Bitte legen Sie Bild-Dateien etc. im Unterordner 3_FILES ab."
End
Sub