AW: UserForm
01.02.2011 14:30:37
René
Hallo Hajo,
ich wollte Dir die Datei einstellen - ist aber zu groß, daher nur das Speichermakro.
Private Sub CommandButton5_Click()
Application.DisplayAlerts = False
Worksheets("Testbogen1").Visible = True
Worksheets("Testbogen1").Activate
Dim oOle As OLEObject
For Each oOle In ActiveSheet.OLEObjects
If LCase(oOle.Name) Like "commandbutton*" Then
Select Case CInt(Replace(LCase(oOle.Name), "commandbutton", ""))
Case 2 To 2
oOle.Visible = False
End Select
End If
Next
Sheets("Kopfdaten").Visible = False
Dim ArrIndex, iIndex%, sExtension$, iFileFormat%, strFileName$
'Dateinamen aus aktuller Zelle
strFileName = Cells(1, 2).Value
If Dir("C:\Testdaten_Buega", vbDirectory) = "" Then
MkDir ("C:\Testdaten_Buega")
End If
'Wechselt das aktuelle Laufwerk.
ChDrive "C:"
'Wechselt das aktuelle Verzeichnis oder den aktuellen Ordner
ChDir "C:\Testdaten_Buega"
'Datei Version
ArrIndex = Array("xlsx", "xlsm", "xls")
'Extention der Datei
sExtension$ = Right$(strFileName, Len(strFileName) - InStrRev(strFileName, "."))
'Dialog aufrufen
SaveAs "C:\Testdaten_Buega\" & strFileName & "_" & "Geburtsdatum" & "_" & Format(Range("F1"), " _
dd_mm_yyyy") & "_" & "Testdatum" & "_" & Format(Range("F1"), "dd_mm_yyyy")
showForm2
Application.DisplayFormulaBar = Stand ' Bearbeitsleiste zurücksetzen
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim WB
If Workbooks.Count > 1 Then
For Each WB In Application.Workbooks
If WB.Name ActiveWorkbook.Name Then
WB.Save
WB.Close
End If
Next
End If
ThisWorkbook.Saved = True
Application.Quit
Application.DisplayAlerts = True
End Sub
Und in der Arbeitsmappe ist eben eine Userform die nicht mit gespeichert werden soll
MfG René