1
votes

I have created an Excel-Document with macros that my customer should fill out save pressing a button.

enter image description here

Under the button is just this macro:

Sub filesave()
    Dim bFileSaveAs As Boolean
    bFileSaveAs = Application.Dialogs(xlDialogSaveAs).Show
End Sub

The problem is that as default option you get to save the document as macro enabled excel workbook.

enter image description here

How can do show as default non macro enabled excel format or not show the posibility to save the document as macro enabled document in oder to make sure that the macros will not be saved in the filled out copy of the document?

Some ideas about how the code should look like?

1
All you have to do is SaveAs .xlsxGMalc

1 Answers

3
votes

You can use GetSaveAsFilename to let the user choose a location and filename and then save with Workbook.SaveAs Method by choosing a file format from XlFileFormat Enumeration.

Public Sub SaveFileAs()
    Dim FileToSave As Variant
    FileToSave = Application.GetSaveAsFilename(fileFilter:="xlsx Files (*.xlsx), *.xlsx")

    If FileToSave <> False Then
        ActiveWorkbook.SaveAs Filename:=FileToSave, FileFormat:=xlOpenXMLWorkbook
    Else
        'user chose cancel
    End If
End Sub