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

¦h¿ïCheckBoxªºVBA«ç»ò¼g¡H

¦h¿ïCheckBoxªºVBA«ç»ò¼g¡H

¦b¤@­ÓÀx¦s®æ¸Ì©ñµÛCheckBox©Ò¿ï¨úªº¶µ¥Ø¡A¨Ã¥Î , ¹j¶}¡A½Ð°Ý³o¬qVBA¬O«ç»ò¼g¡HÁÂÁ¡I


CheckBox.rar (14.15 KB)

¦^´_ 1# maikoyuki
  1. Private Sub CommandButton1_Click()
  2. Dim Ct As OLEObject
  3. For Each Ct In Me.OLEObjects
  4.   If Ct.progID = "Forms.CheckBox.1" Then
  5.    If Ct.Object.Value = True Then mystr = IIf(mystr = "", Ct.Object.Caption, mystr & "," & Ct.Object.Caption)
  6.   End If
  7. Next
  8. [B11] = mystr
  9. End Sub

  10. Private Sub CommandButton2_Click()
  11. For Each Ct In Me.OLEObjects
  12.   If Ct.progID = "Forms.CheckBox.1" Then
  13.    Ct.Object.Value = False
  14.   End If
  15. Next
  16. [B11] = ""
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh
¤£¦n·N«ä , ·Q½Ð±Ð¤@¤U
Me.OLEObjects ¬O¤£¬O«ü¸Ó¤u§@ªíªº©Ò¦³ActiveX±±¨î¶µ? ¤£§tªí³æ±±¨î¶µ?

ÁÙ¦³  Ct.progID = "Forms.CheckBox.1"
±±¨î¶µªºprogID­n«ç»ò±oª¾ ?  ".1" ¦³¯S§O·N¸q¶Ü?
¨ä¥Lªº±±¨î¶µ¤]¬O¦P¼Ë®æ¦¡¶Ü?

TOP

¦^´_ 3# stillfish00
¨S¿ù¤£¥]§tªí³æ±±¨î¶µ
¦]¬°¬O¦b¤u§@ªí¤¤«ö¶sªºµ{§Ç¡A©Ò¥HME´N¬O«ü¸Ó¤u§@ªí
progID¥i¿ï¨ú¸Óª«¥ó«á¡A¬Ý½s¿è¦C¤¤ªº¨í¸¹¤º¤å¦r
   
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh
ÁÂÁª©¤j¶}¥Ü~

TOP

¦^´_  maikoyuki
Hsieh µoªí©ó 2012-11-21 19:46



   
ÁÂÁ¤j­ô¸Ñµª¡A¶¶«K½Ð°Ý¤@¤U¡A¦pªG¤u§@ªí¤¤¦³«Ü¦h­ÓForms.CheckBox.1¡BForms.TextBox.1¡BForms.OptionButton.1¡BForms.ListBox.1¡BForms.ComboBox.1µ¥­n§â¥¦­Ì¥þÅܦ¨ªÅ­È¡A¥N½XÀ³¸Ó¦p¦ó²³æªº¼g¡HÁÂÁ¡I

TOP

¦^´_ 4# Hsieh
½Ð°Ý Hsieh ª©¤j¡A ªí³æ±±¨î¶µ¥u¯à³]©w¦b UserForm ¤º¶Ü¡H
  1. Private Sub UserForm_Click()
  2.     Dim Ct As Control, mystr As String
  3.       
  4.     For Each Ct In Me.Controls
  5.         If TypeName(Ct) = "CheckBox" Then
  6.             If Ct.Value = True Then mystr = IIf(mystr = "", Ct.Caption, mystr & "," & Ct.Caption)
  7.         End If
  8.     Next
  9.     Sheet1.[B12] = mystr
  10. End Sub
½Æ»s¥N½X
¦pªG±N¥H¤W»yªkÀ³¥Î¦b ¤u§@ªí³æ Sheet1 ¥»¨­¤ºªº¸Ü¡A ¥L·|¥X²{ "§ä¤£¨ì¤èªk©Î¸ê®Æ¦¨­û"¡A
½Ð±z½ç±Ð¡AÁÂÁ¡I

TOP

¦^´_ 7# c_c_lai


    2#µ{¦¡½X¾A¥Î©ó¤u§@ªí¤ºActiveX±±¨î¶µ
½Ðª`·N©Ò¿×ªí³æ±±¨î¶µ¸òActiveX±±¨î¶µªº°Ï§O
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# Hsieh
§Ú«üªº¬O¡G


ÁÂÁ±z¡I

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-11-22 16:51 ½s¿è

¦^´_ 9# c_c_lai
Me.Controls         ->UserFormªí³æ(MSForms)ªº±±¨î¶µª«¥ó¶°¦X
Me.OLEObjects   ->¤u§@ªí¤¤ªº±±¨î¶µª«¥ó¶°¦X

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD