ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó§PŪuserform.combobox1¬O§_¦s¦b

[µo°Ý] ¦p¦ó§PŪuserform.combobox1¬O§_¦s¦b

½Ð±Ð½Ñ¦ì¤j¤j:
       ¦p¦ó§PŪuserform.combobox1¬O§_¦s¦b?
        ÁÂÁ«ü¾É!

¥»©«³Ì«á¥Ñ n7822123 ©ó 2018-11-11 13:45 ½s¿è

¦^´_ 1# yangjie

³o¬O§Ú²Ä100­Ó©«¤l!

¤èªk1:ª½±µ¦b¸Óªí³æ(Userform1)¿é¤J¥H¤Uµ{¦¡§P§O

Dim ¦s¦b As Boolean
For Each c In Controls
  If c.name = "ComboBox1" Then ¦s¦b = True
Next
MsgBox IIf(¦s¦b, "ComboBox1¦s¦b", "ComboBox1¤£¦s¦b")


¤èªk2:¦b¼Ò²Õ¤¤«Ø¥ß¦Û©w¨ç¼Æ§P§O(¨â­Ó¤Þ¼Æ¡A²Ä¤@­Ó=ªí³æ¦W¤l¡A²Ä2­Ó=±±¨î¶µ¦W¤l)
          ¥i¥H¦b¥ô·Nªí³æªºµ{§Ç¤¤ ©ÎªÌ ¼Ò²Õªºµ{§Ç¤¤°µ§P§O


If IsCtrExist("UserForm1", "ComboBox1") Then MsgBox "¦s¦b" Else MsgBox "¤£¦s¦b"

Public Function IsCtrExist(ByVal nameUF As String, ByVal nameC As String) As Boolean
Dim ¦s¦b1 As Boolean
Dim ¦s¦b2 As Boolean
Dim N%, i%
For i = 1 To UserForms.Count
  If UserForms.Item(i - 1).name = nameUF Then ¦s¦b1 = True: N = i - 1
Next i
If Not ¦s¦b1 Then GoTo 101
For Each c In UserForms.Item(N).Controls
  If c.name = nameC Then ¦s¦b2 = True
Next
101:
If ¦s¦b2 Then IsCtrExist = True Else IsCtrExist = False
End Function
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

Chk = IsObject(ComboBox11)
MsgBox Chk

TOP

¥»©«³Ì«á¥Ñ yangjie ©ó 2018-11-12 17:49 ½s¿è

¦^´_ 2# n7822123
ÁÂÁÂ n7822123
ÁÂÁ  ­ã´£³¡ªL
§¹¥þ¤F¸Ñ

TOP

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD