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

½Ð±ÐUserForm±a¤J¤Þ¼Æ»P±a¥X¤Þ¼Æªº°ÝÃD

½Ð±ÐUserForm±a¤J¤Þ¼Æ»P±a¥X¤Þ¼Æªº°ÝÃD

½Ð±Ð¦U¦ì¤j¤j¡G
¤pªº§ÚÀ|¸Õ§@¤F¤@­ÓUserForm, ¸Ì­±¦³¤@­ÓListBox, ¤@­ÓCommandButton
·Q»¡¯à§_¦bUserForm.Show®É¯à¦P®É¸ü¤J¤@­ÓName_AR() as variant¡AÅý³o­Ó¤º®e­È­Ë¤JListBox¡A¿ï¨ú§¹²¦«á¡A«ö¤UCommandButton«á¯à±a¥X¤@­ÓOutput_AR() as variant¡AÅý§Úª¾¹D¦³¨º¨Ç³Q¿ï¨ú¨ì¡A
¸ü¤J§Ú§ä¨ì¥i¨Ï¥Î
Public Property Let Value(Data_AR() as variant)
¨Ó³B²z¡A¦ý¬O¸ü¥X®É¡AÁöµM¤]¥i¥H¥Î
Public Property Get Value() as Variant
¦ý¬O§ä¤£¨ì¦nªº®É¶¡ÂI¨Ó°µ³o­Ó¡A¤£ª¾¹D¦U¦ì«e½ú¯à¤£¯àµ¹§Ú¤@¨Ç«Øij©O¡H·PÁ±z¡C
clio

¦^´_ 1# clio
³q±`©I¥sªí³æ´N¬O¦b¤@¯ë¼Ò²Õ©I¥s
Load Userform1
©M
Userform1.Show

¦pªG­n¶Ç¤@¨Çªì©l¤Æªº¸ê®Æµ¹ªí³æ¡A¥i¦bªí³æµ{¦¡½X·s¼W¦pSub InitForm(arInput)
  1. Public Sub InitForm(arInput)
  2.     ListBox1.List = arInput
  3. End Sub
½Æ»s¥N½X
¤@¯ë¼Ò²ÕShow¤§«e©I¥sInitForm¶Ç»¼µ¹ªí³æ
  1. Sub Test()
  2.     Dim ar
  3.     ar = Array("A", "B", "C")
  4.    
  5.     Load UserForm2
  6.     UserForm2.InitForm ar
  7.     UserForm2.Show
  8. End Sub
½Æ»s¥N½X
Userform «ö¶s«á¨ú±o¤w¿ï¶µ¥Ø
  1. Private Sub CommandButton1_Click()
  2.     Dim Output_AR(1 To ListBox1.Count)
  3.     Dim i As Integer, cnt As Integer
  4.    
  5.     For i = 1 To ListBox1.ListCount
  6.         If ListBox1.Selected(i) Then
  7.             cnt = cnt + 1
  8.             Output_AR(cnt) = ListBox1.List(i)
  9.         End If
  10.     Next
  11.     If cnt > 0 Then
  12.         ReDim Preserve Output_AR(1 To cnt)
  13.         '¦Ü¦¹ Output_AR ¤w¨ú±o¿ï¾Üªº¶µ¥Ø
  14.     End If
  15. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 2# stillfish00

¬Oªº¡A³o¼Ë¼g½T¹ê¨S¦³¿ù¡A¦ý¬O§Ú­n«ç»ò§âOutput_AR¥ÑUserForm°e¥X¨Ó¨ìFunction¤º¨Ó©O¡H
³oÂIÅý§Ú·Q¤£¥X¨Ó
clio

TOP

jackyq«e½ú¡G
·PÁ±zªº¦^ÂСA¥Ñ©ó§ÚÅv­­¤£¨¬¡A¦pªk¨p°T±z¡A¨S¦³¸g¹L©pªº¦P·N¡A§Ú¤]¤£´±§â©pªº¤èªkPO¥X¨Ó
·Ó±z»¡ªº¤èªk¡A¨ºOutput_AR´N­n³]¦¨¥þ°Ï°ìÅܼơA¤~¯à°µ¨ì¡A¬O¶Ü¡H
clio

TOP

¤£, ¨º¬O«Ü´¶³qªº¤èªk
¨ä¥L¤j¤j³£·|
§Ú±`·d¯QÀs¤~¨p¤U¸ò§A»¡
¦Ñ¹ê»¡
¤j¤j¨S¦³§â°ÝÃDªí¹F²M·¡
¤£µM¨ä¥L¤j¤j¦­´N§iª¾§A¼gªk

§Ú¤]¥u¬O²qªº, §A·Q·F³Â

§A¬O¤£¬O·Q±q Sheet1 or Sheet2 ...  ¥~³¡¥h±±¨î¨º­Ó UserForm1
·í¬Y¬Y¨Ï¥ÎªÌ«ö¤U  UserForm1 ¤Wªº  CommandButton «á
§A§Æ±æ¯à±q  Sheet1 §ì¨ì¨º­Ó¨Ï¥ÎªÌªº Listbox ¤Wªº¿ï¨ú¶µ¥Ø ?
¦pªG¬O Output_AR  ¤£¥Î³]¦¨¥þ°Ï°ìÅܼÆ

TOP

¦^´_ 3# clio
§Aªº·N«ä¬O·Q¦A§âOutput_AR¶Ç¦^Test¤º?

³q±`§Ú¬O¤£·|¦A¶Ç¦^Test°Õ¡A¬JµM§Ú¤w¸g¦³Output_AR¡A¦pªG§Ú­n°µ¬Æ»ò¤ÀªR©Î³B²z¡A´N¦bClick¤º©I¥s§Ú­n³B²zªºFunction ¨Ã§âOutput_AR¶Ç¨ì§Ú­n³B²zªºFunction¤º¤£´N¦n¤F?

°í«ù­n¶Ç¦^Testªº¸Ü¡A´N¦b¤@¯ë¼Ò²Õ«Å§i¤@­Ó¼Ò²Õ¼h¦¸ªº¤½¥Î(Public)ÅܼơA«e­±ªºOutput_AR³£§ï¦¨ª½±µ¥Î³o­Ó¤½¥ÎÅܼơA³o¼ËTest¤º¤]¯à¬Ý¨ì³o­ÓÅܼƴN¤£¥Î¶Ç¤F¡C
¤£¹L¡A§A­n¥ýª`·Nªº¬O¹w³]ªºªí³æ¡A·í§A©I¥sUserForm2.Show«á¡Aªí³æÅã¥Ü¥X¨Ó¡Aµ{¦¡·|°±¯d¦b¸Ó¦æ¡A·|¤@ª½µ¥¨ìªí³æÃö³¬¤~·|¸õ¨ì¤U¤@¦æ¡C

°Ýªº¤£°÷©ú½T§Ú¤]¥u¯à³o¼Ë¦^µª°Õ¡C
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 6# stillfish00

·PÁ«e½úªº¦^ÂСA¦]¬°§Ú¬O­nµ¹¤@¦ê¤H¦W¡AÅý¨Ï¥ÎªÌ¤Ä¿ï±¼¤£­nªº¤H¡A©Ò¥H§Ú¤~·|»Ý­n¦A§âµ²ªG¶Ç¦^¡A¦nÅýµ{¦¡±µ¤U¥h³B²z³o¨Ç¤Hªº«áÄò°Ê§@¡A³o¼Ë¬Ý°_¨Ó¥Î¤½¥ÎÅܼƬO¤ñ¸û¦nªº¿ï¾Ü¡A·PÁ±zªº¦^ÂСAÁÂÁÂ
clio

TOP

¦^´_ 5# jackyq

·PÁ¤j¤j¡A§Ú¤j­P¤W¬O­n°µ³o¥ó¨Æ¡A§ÚªºOutlook¦³«Ü¦h­ÓMail ¸s²Õ¡A¨C¤@­Ó¸s²Õ¸Ì­±ªº¤H¼Æ¤£¦P¡A·í§Ú·s¼W¤@­Ó¤H®É¡A§Ú·|±N¥L§@¤ÀÃþ¡A¨Ì¾Ú¥Lªº¤ÀÃþ¨ì¨ì¦U§Oªº¸s²Õ¤º¡A¦ý¬O­n¬O¦³¦P¤@®a¤½¥qªº¤H¡A§Ú«h§Æ±æ¸õ¥X¤@­Ó²M³æ¡AÅý§Ú¤Ä¿ï±¼¡A¤£­nªº¤H¡A©Ò¥H§Ú¤~»Ý­n¦³¶Ç¦^­È¡A¦nÅý§Úª¾¹D¨º¨Ç¤H¸Ó±q¸s²Õ¤º§R±¼¡A¤£ª¾¹D§Ú³o¼Ë»¡©ú¬O§_²M·¡¡A·PÁ±z
clio

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD