通过 vb.net 自动化时,Excel 验证 0x800A03EC 出现任何错误解决方案。
注意:相同的代码在 90% 的系统中运行,而在其余的系统中同样失败。
以下是我使用的代码:
For K = 2 To 1000
objxl.Range("F" & K).FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-2]&RC[-2],C[13]:C[14],2,0),"""")"
Next
i = 25
objxl.Range("D2:D1000").Select()
If lastrow_main = 2 Then
lastrow_main = lastrow_main
Else
lastrow_main = lastrow_main - 1
End If
With objxl.Selection.validation
.Delete()
.Add(Type:=Excel.XlDVType.xlValidateList, AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertStop, Operator:= _
Excel.XlFormatConditionOperator.xlBetween, Formula1:="=$X$2:$X$" & lastrow_main & "")
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With