I’m building an excel add in using c#, and i want the user to select a range.
I have the inputbox set up and it’s receiving the range fine when entered as a text.
The problem is that excel is unresponsive when the inputbox is open, the user can’t go over to excel and just select the range with the mouse, after i stop the debugging i get a message that the “File Now Available”.
This is the part of the code
Excel.Range str = excelApp.InputBox("Select table range", "", _ Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 8); MessageBox.Show("range = " + this.range.get_Address());
This is entirely by design and standard for any Windows user interface. The InputBox function display a modal dialog. Dialogs always disable the other windows in an application. Very annoying but an important safety measure to prevent problems due to re-entrancy. This answer explains why modal dialogs behave that way.
You will have to cook up your own non-modal input form to work around that restriction. Do note the trouble you might get into when you do, as shown in the linked answer. You won’t have much to fear from the user-closes-ui problem, that will kill the form as well. But definitely the user-reissues-command problem.
Check this out: how to select an excel range using RefEdit control
I can update the code if you require. Please give it a try first.