none
Named Range box not updating the Name of the selected Range RRS feed

  • Question

  • Hi,

    we have a VSTO add-in for Excel that will expose a ribbon button to launch a windows form displaying all validated cells. The form is a model form and has button to go to the corresponding validated cell range.  

    We have Workbook_SheetSelection change event handled in the code. So whenever i click the button in the form to go to the cell range the event is fired but however the named range box in excel doesnt update the Named Range value. Below images are pulled from a sample that i wrote to simulate the issue. 

    In the below image Range A4 has a name called UniqueID.


    There is model form that is displayed to the user which is activated from RibbonButton click. 

    Now when Button1 is clicked Range "A4" is selected but however the NameBox doesn't get updated to show the "UniqueID" text.

    Once i close the form i can see the NameBox updating to display the UniqueID text properly. I can't make my from modeless as i dont want any user interaction with the Excel while the form is open. Can i get the NameBox to update the text while the form is still shown ? or is there any way to update the Name Box manually?

    Thanks in advance. 

    Tuesday, January 20, 2015 5:12 PM

All replies

  • Hello,

    > Can i get the NameBox to update the text while the form is still shown ?

    No, because the modal form is displayed. The UI will not be updated until you close the form.

    > or is there any way to update the Name Box manually?

    You need to show the form as non-modal. Only in that case the UI will be updated.

    Why do you need to have the name box updated? Have you considered displaying your own text box with the selected named range value on the form instead?

    • Proposed as answer by L.HlModerator Wednesday, January 28, 2015 8:53 AM
    Wednesday, January 21, 2015 1:57 PM