here is what I am trying to do:
I am trying to have an if statement that looks at the Input UserName and if somebody has not entered a name before, then the file is supposed to be saved like shown below. But if somebody has already entered a name, anything at all before, then the file is supposed to be saved like shown under the command else.
I am a newbie & your help is much appreciated! Here is my code:
Private Sub CommandButton3_Click()
Dim FilePath As String
Dim Filename As String
Dim MyDate As String
Dim UserName As String
If UserName = "" Then
FilePath = "//SRVDC\Arbeitsordner\Intern\Meetings\Entwürfe\"
MyDate = Format(Date, "YYYYMMDD")
Filename1 = "_Besprechungsnotizen_i_00_"
UserName = InputBox("Wer erstellt? (Name in Firmenkurzform)")
ActiveDocument.SaveAs2 FilePath & MyDate & Filename1 & UserName
Else
FilePath = "//SRVDC\Arbeitsordner\Intern\Meetings\Entwürfe\"
MyDate = Format(Date, "YYYYMMDD")
Filename1 = "_Besprechungsnotizen_i_0"
Filename2 = "_"
UserName = InputBox("Wer bearbeitet? (Name in Firmenkurzform)")
Version = InputBox("Welche Version? (in ganzen Zahlen)")
ActiveDocument.SaveAs2 FilePath & MyDate & Filename1 & Version & Filename2 & UserName
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire