Gruppe
Datei
Problem
Wie kann ich Sicherheitskopien von Arbeitsmappen anlegen, nachdem ich vorher über InputBox abgefragt habe, welche Arbeitsmappen gespeichert werden sollen?
StandardModule: basMain
Sub Speichern()
Dim wkb As Workbook
Dim sSave As String, sFile As String
Dim sOld As String, sPath As String
sSave = InputBox("Backup für ""alle"" oder " & _
"""aktive"" Arbeitsmappe(n)?", , "aktive")
If sSave = "" Then Exit Sub
sPath = Range("B1").Value
If sSave = "alle" Then
For Each wkb In Workbooks
sFile = wkb.Name
sPath = wkb.FullName
wkb.SaveAs Range("B1").Value & sFile
wkb.SaveAs sPath
Next wkb
Else
Set wkb = ActiveWorkbook
sPath = wkb.FullName
wkb.SaveAs Range("B1").Value & ActiveWorkbook.Name
wkb.SaveAs sPath
End If
End Sub