[Advanced Excel] WorkBook_AddSheet Action returns an error when I try to add sheets to an .xlsm file
Forge component by Carlos Freitas
Application Type
Traditional Web

I am trying to add sheets to a .xlsm type file and I'm getting the error: "Object reference not set to an instance of an object."

The code is as follows

Hello @Ana Nunes 

I have a few questions which I hope point you to the root cause:

1. Which step does the error occur at specifically?

2. The logic opens two workbooks - OpenOriginalFile and OpenFileToCopy, however, I cannot confirm from the screenshot whether they already exist or have been created prior. Before opening a workbook it must be either exist or be created, if not, you may get the object reference error.

3. 'Worksheet_SelectClauseSheet' specifies an Index of '2' but does it exist?

Best regards,


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.