Saving a VSTO Copy in VSTO Format

I am trying to save a ListObject from .NET 3.5 Excel 2007 VSTO Workbook to a new sheet (done) and save this new sheet in a new book (done) without this book requiring a VSTO configuration file (!!!!!).

Is anyone lucky with this? The only way to succeed is to save only the CSV file, but this is not entirely acceptable in this case. I would prefer not to save to CSV to copy back to the XLS file.

.SaveAs worksheet (saveDialog.FileName, Excel.XlFileFormat.xlOpenXMLWorkbook)

+4
source share
2 answers

If I understand correctly, you do not want the new workbook file to hang or load any VSTO setting?

Try the MSDN link to remove the VSTO builds from the configuration books.

+5
source

Well, that did not work for me, and that is why. The answer is still correct, but I want to clarify for future users.

I have a ListObject that I would like to store in an external workbook using VSTO. Creating a new worksheet and using SaveAs would rename the current Workbook, and so I would have to close the entire workbook to remove the setting.

What I had to do from the very beginning was:

Create a worksheet and fill out ListObject on this worksheet. Then use .Copy () without parameters to create a new book. How do I find a book now? I simply called Worksheet Now.Ticks.ToString () and searched for any open book using ActiveSheet.Name as Now.Ticks.ToString (). For this application, it should not be deeper than that. I saved this book and then closed it. Since the workbook was created using Copy, it had no settings and the problem was resolved.

+1
source

All Articles