我製作了一個用戶表單,其中所有字段都是必填項。此用戶表單上有5個頁面。我需要把重點放在驗證空間的領域。我想這樣做,與ISERROR聲明在多頁面中動態設置焦點
暗淡我作爲整數
For Each ctrl In Controls 'loop through Controls and search for Control with the right name
i = 0
If ctrl.Value = "" Then
MsgBox ctrl.Name, vbExclamation, "Input Data"
While IsError(ctrl.SetFocus)
UserForm1.MultiPage1.Value = i
i = (i + 1) Mod 5
Wend
ctrl.SetFocus
Exit Sub
End If
Next
我也嘗試沒有成功
Dim i As Integer
For Each ctrl In Controls 'loop through Controls and search for Control with the right name
i=0
If ctrl.Value = "" Then
MsgBox ctrl.Name, vbExclamation, "Input Data"
On Error GoTo ErrHandler:
ctrl.SetFocus
ErrHandler:
UserForm1.MultiPage1.Value = i
i = (i + 1) Mod 5
Resume
Exit Sub
End If
Next
任何幫助將不勝感激
做着同樣的一個錯誤處理程序
是否所有的字段文本框/列表框/組合框或者你有其他類型的控件? – Rory 2014-09-22 11:17:37
不僅僅是checkbox/testbox/listbox內部框架[某些情況下] – Sm1 2014-09-22 11:31:48