命名范围框不更新所选范围的名称 [英] Named Range box not updating the Name of the selected Range

查看:64
本文介绍了命名范围框不更新所选范围的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用于Excel的VSTO加载项,它将显示一个功能区按钮以启动显示所有已验证单元格的窗体。表单是一个模型表单,并具有转到相应的验证单元格范围的按钮。  

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.  

我们在代码中处理了Workbook_SheetSelection更改事件。因此,每当我单击表单中的按钮转到单元格范围时,事件就会被触发,但是excel中的命名范围框不会更新命名范围值。下面的图片从我编写的样本中抽取
来模拟问题。 

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. 

在下图中,范围A4的名称为UniqueID。

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




向用户显示的模型表单是从RibbonButton点击激活的。 

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

现在,当点击Button1时,范围为"A4"。已选中,但NameBox未更新以显示"UniqueID"文本。

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

关闭表单后,我可以看到NameBox更新,以正确显示UniqueID文本。我无法使我无模式,因为我不想在表单打开时与Excel进行任何用户交互。我可以获取NameBox更新文本,而表单仍然是
?或者有没有办法手动更新名称框?

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. 

推荐答案

您好,

> ;在表单仍然显示时,我可以让NameBox更新文本吗?

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

不,因为会显示模式表单。在关闭表单之前,UI不会更新。

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?

您需要将表单显示为非模态。只有在这种情况下才会更新UI。

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?


这篇关于命名范围框不更新所选范围的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆