Question

Contrary to what I would think, multiple selected sheets are not a Worksheets object type.

After multi-selecting 2 or more sheets. The way I get the selection is as so:

var selection = ExcelApp.Selection; //Returns object type

I've tried getting the "Name" property to try and give me a hint by using late binding with:

string name = selection.GetType().InvokeMember("Name", System.Reflection.BindingFlags.GetProperty, null, selection, null).ToString();

But this throws errors for the given selection type.

Any ideas?

Was it helpful?

Solution

In VBA, ActiveWindow.SelectedSheets returns a Sheets collection, so I imagine it will be similar in C#

Yep: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.window.selectedsheets(v=office.11).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top