下面我的代码适用于Excel VBA,但我正在更改为VB userform。问题是我不能再使用OLEObjects了,所以在VB中有一个解决方法,让我在userform中工作吗?或者我需要把它放在长篇if语句中。提前谢谢。
Dim Fun As Variant
Dim Tmp As Variant
Dim Inv() As String
Dim i As Integer
Inv = Split("NBInv NEBInv EBInv SEBInv SBInv SWBInv WBInv NWBInv")
Fun = 0
For i = 0 To UBound(Inv)
Tmp = Val(MainForm.OLEObjects(Inv(i)).Object.Value)
If Tmp <> 0 And Tmp <> "" And Tmp > Fun Then Fun = Tmp
Next i
Smallest = Fun
MsgBox Smallest