Export Sheet as Excel file

A tool purpose is to generate an input for another program or dashboard.

Input files are mostly requested as text .txt file or as excel .xlsx file.

Using a macro we can export sheets from excel.

Export one sheet as .xlsx file

This program uses a macro that will do the export of single spreadsheets from current workbook. Using the Application.SaveAs  the new workbook is saved as excel file.

Sub ExportSheet_SaveAsDialog()
    Dim wb As Workbook, InitialFileName As String, fileSaveName As String
    InitialFileName = ThisWorkbook.Path & "\ - Recon_Output_ " & Format(Date, "yyyymmdd")
    Sheets("Final List").Copy
    Set wb = ActiveWorkbook
    fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitFileName, _
    filefilter:="Excel files , *.xlsx")
    With wb
        If fileSaveName <> "False" Then
            .SaveAs fileSaveName
            .Close
        Else
            .Close False
            Exit Sub
        End If
    End With
End Sub
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

TIPS:

  1. For the VBA macro to export one SpreadSheet export as text .txt file check HERE.
  2. For the VBA macro to export multiple SpreadSheets export as excel .xlsx file check HERE.