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

[µo°Ý] ¨ÌÄæ¼Æ«Ø¥ß¿ï¶µ¡A¨Ã¦³¬Û¦üµ{¦¡«ü¥O

¦^´_ 2# lpk187

ÁÂÁÂ

³æ¯Â³o¼Ë¨Ï¥Î¥i¥H
¥i¬O­Y­n®M¥Î¶i¨ä¥Lµ{¦¡
¦³®É·|²{¦b¥i¥H µy·L±±¨î¹³°µ¨Ç­×§ï«á ´N¤S¤£¦æ¤F
±`±`·|¦b  Set X_OB(A).OB = Controls(A)     ³o¦æ¥X²{¿ù»~

§Æ±æ°ª¤â­Ì¯àÄ~Äò«ü¾É
ÁÂÁÂ

TOP

¤µ¤Ñ·Q¨ì 1­Ó¤èªk ¤£»Ý¥Î  Dim X_OB( ) As New Class1  ( ¦h¤@­Ó Class )
¦Ó¬O§â private  WithEvents OB_±±¥ó°}¦C  As MSForms.OptionButton ª½±µ©ñ¦b UserForm  ¸Ì­±
´N¥i¥H¹ê²{±±¥ó°}¦Cªº¤èªk
¥i¥H´î¤Ö³Â·Ð
¦³µy¬° try ¹L, ¦n¹³¥i¦æ  ......  good!!

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-6-16 22:23 ½s¿è

¦^´_ 1# lyc43210


   
¤]¤£ª¾¹ï¤£¹ï¡A¨þ¨þ¡I§Ú¤]¬O½m²ß
UserForm:
  1. Dim X_OB() As New Class1

  2. Private Sub UserForm_Initialize()
  3.     I = Cells(1, 1).End(xlToRight).Column
  4.     h = 0
  5.     ReDim X_OB(1 To I)
  6.     Dim myC As Control
  7.     For A = 1 To I
  8.         Set myC = Controls.Add(bstrprogid:="Forms.optionButton.1")
  9.         myC.Top = h
  10.         h = h + 20
  11.         myC.Caption = Cells(1, A)
  12.         Set X_OB(A).OB = Controls(A)
  13.     Next A
  14. End Sub
½Æ»s¥N½X
Class1:
  1. Public WithEvents OB As MSForms.OptionButton

  2. Private Sub OB_Click()
  3.     UserForm1.Label1 = OB.Caption
  4. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¯u¥¿ªº·R¤ß¡A¬O·ÓÅU¦n¦Û¤vªº³oÁû¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD