Preserve original workbook, but add new sheet?

S

Stuart

In an addin's routine, user navigates and chooses a workbook
to be opened by the code (I know a copy has been opened).

I would like to be sure that when that book is closed, the
only acceptable change is the addition of a new code-created
sheet.

I can only see the following option:

open the workbook (say "testbook")
SaveAs "1" & "testbook"
Close "1" & "testbook" (perhaps not neccessary)
Open "testbook"
Do all the code
Create the new sheet
Open "1" & "testbook"
Add the new sheet to it
use DisplayAlerts=False
SaveAs "testbook"

Does this seem feasible and/or is there a better way, please?

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top