Forum Discussion

aekbus's avatar
aekbus
Brass Contributor
Jun 12, 2026
Solved

Excel Macro Creating a New Macro Enabled Spreadsheet

I have a macro enabled spreadsheet.  I have a macro in this spreadsheet that is trying to create another macro enabled spreadsheet.  I can create this new spreadsheet and save it as a .xlsm file.  However, I want to give this spreadsheet a name and transfer data to it by toggling between my two sheets (Windows(Filename).Activate) and not save it until I am done.  My problem is that the only way I have found to name it is with SaveAs statement.  If I could find out what name Excel assigned to this workbood when I created it, I could work with it - but I have not found a way to do that.

If the above is confusing, I am sorry.  In simple terms, I want my macro to create another macro enabled spreadsheet, name it, work with it and Save it without using SaveAs.

I can provide code, but I thought I would start with this.

  • Afternoon AEKBUS,

           Before you exit the newly created sheet, use a variable to get the active window caption (or workbook name) "V = ActiveWindow.Caption" 

2 Replies

  • MKoski's avatar
    MKoski
    Brass Contributor

    Afternoon AEKBUS,

           Before you exit the newly created sheet, use a variable to get the active window caption (or workbook name) "V = ActiveWindow.Caption" 

    • aekbus's avatar
      aekbus
      Brass Contributor

      Thank you very much for your answer.  I knew it had to be a simple solution, but I am not very familiar with the vocabulary.