.net 数据验证下拉列表仅在出现msgbox时显示

.net 数据验证下拉列表仅在出现msgbox时显示,.net,vb.net,vsto,.net,Vb.net,Vsto,这听起来可能很奇怪 我刚刚在Excel中进行了数据验证,我知道它正在工作。默认情况下不显示Incell下拉列表。但如果我在该行之前创建一个msgbox,则会显示incelldropdown 此处显示INCELL下拉列表: MsgBox("hello") Me.Range("A6:A20").Validation.Add(Type:=Excel.XlDVType.xlValidateList, _ AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertSt

这听起来可能很奇怪

我刚刚在Excel中进行了数据验证,我知道它正在工作。默认情况下不显示Incell下拉列表。但如果我在该行之前创建一个msgbox,则会显示incelldropdown

此处显示INCELL下拉列表:

MsgBox("hello")
Me.Range("A6:A20").Validation.Add(Type:=Excel.XlDVType.xlValidateList, _
   AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertStop, _
   [Operator]:=Excel.XlFormatConditionOperator.xlBetween, Formula1:="=named_range1")
Me.Range("A6:A20").Validation.InCellDropdown = True
但如果我删除MsgBox,Incell下拉列表将不显示:

Me.Range("A6:A20").Validation.Add(Type:=Excel.XlDVType.xlValidateList, _
AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertStop, _
   [Operator]:=Excel.XlFormatConditionOperator.xlBetween, Formula1:="=named_range1")
Me.Range("A6:A20").Validation.InCellDropdown = True
如有任何意见,将不胜感激。谢谢