Save file as with VBA in Microsoft Excel

In the dialog for saving a file, a single file name can be preset, among other things.

Sub DateiSpeichernUnter()
Dim Erfolg As Boolean
Workbooks.Add
Erfolg = Application.Dialogs(xlDialogSaveAs). _
Show(arg1:="Test.xlsx")
If Not Erfolg Then _
MsgBox "Keine Datei ausgewählt"
End Sub

The constant is xlDialogSaveAs. If the user only clicks the Save button, the newly created file is saved under the name Test.xlsx.

In versions prior to Excel 2007, the file name in the procedure and explanation must be as follows: Test.xls.

Was the explanation to "Save file as with VBA in Microsoft Excel"Helpful? Rate now:

Weitere Erklärungen zu Skriptsprachen