Search code examples
vbaautosave

Application.GetSaveAsFilename - Autosave with VBA


Application.GetSaveAsFilename - Autosave with VBA

Is it possible to save a file file without "save as dialog box"?

the file and name is generated after click on a button, now I need to save that file without "save as dialog box"

EDIT : the question was NOT about saving excel file.


Solution

  • You can use Workbook.SaveAs

    For further information, check the following webpage:

    Workbook.SaveAs Method (Excel)

    Syntax:

    Workbook.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)

    1. FileName: DataType = String; Description = File Full Path; DefaultValue = ""
    2. FileFormat: DataType = XlFileFormat; Description = File Extension;
    3. Password: DataType = String; Description = Protection Password; DefaultValue = ""
    4. WriteResPassword: DataType = String; Description = Write Reservation Password; DefaultValue = ""
    5. ReadOnlyRecommended: DataType = Boolean; Description = Show Read-Only Recommended Message; DefaultValue = False
    6. CreateBackup: DataType = Boolean; Description = Create Backup File; DefaultValue = False
    7. AccessMode: DataType = XlSaveAsAccessMode; Description = Workbook Access Mode; DefaultValue = XlSaveAsAccessMode.xlNoChange
    8. ConflictResolution: DataType = XlSaveConflictResolution; Description = Save Conflict Resolution; DefaultValue = XlSaveConflictResolution.xlUserResolution
    9. AddToMru: DataType = Boolean; Description = Add to Recent Files; DefaultValue = False
    10. TextCodepage: Description = Ignored for all languages in Microsoft Excel.
    11. TextVisualLayout: Description = Ignored for all languages in Microsoft Excel.
    12. Local: DataType = Boolean; Description = Saving Local Language; DefaultValue = False