By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

Opening an already opened Excel workbook in C#/VB

P: n/a

Would anyone know how I could open an already opened excel workbook.

I have Windows Form with a button, and when clicked it opens the
spreadsheet as follows
string filename = @"C:\Documents\Test.xls";

Excel.Application ea = new Excel.Application();

Excel.Workbook wb = ea.Workbooks.Open(filename, 0, true, 5, "", "",
true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

ea.Visible = true;
But now if the user clicks a second time on the button I would like to
check that the file is not opened and inform him/her to closed it.
such as: if ( wb.isAlreadyOpened() == true )
MessageBox.Show("Close file

Jun 17 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.