VSTO: workbook.Save() doesn't save

D

denton

Excel.Worksheet w3 = (Excel.Worksheet)this.Worksheets.get_Item(3);
Excel.Range r1 = w3.get_Range("A1", Type.Missing);
r1.Value2 = "a1";
this.Save();
Application.Quit();

When the program is done, my workbook in VS 2005 is not saved. Please help
or point in right direction. Learning VSTO is difficult since it is unstable
and there are few resources for help.
 
C

Cindy M.

Hi =?Utf-8?B?ZGVudG9u?=,
Excel.Worksheet w3 = (Excel.Worksheet)this.Worksheets.get_Item(3);
Excel.Range r1 = w3.get_Range("A1", Type.Missing);
r1.Value2 = "a1";
this.Save();
Application.Quit();

When the program is done, my workbook in VS 2005 is not saved. Please help
or point in right direction. Learning VSTO is difficult since it is unstable
and there are few resources for help.
When you use VSTO 2005 "this" actually refers to the VSTO customization and not
the actual workbook file. Try with: this.InnerObject.Save()

The InnerObject property gives you the actual workbook file.

Also, if you're working with VSTO 2005 you should NOT usually be sending
Application.Quit. This is something the user ought to be doing.

For assistance with VSTO, the best place to ask is in the forum

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=16&SiteID=1&PageID=0

I suggest you search Application.Quit there, as this topic has come up in
discussions.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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