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

VBA¬O§_¥i¥H«Ø¥ß°ÊºAUserForm

VBA¬O§_¥i¥H«Ø¥ß°ÊºAUserForm

½Ð±Ð¦U¦ì°ª¤â¡A¤£ª¾¹DVBA¬O§_¯à«Ø¥ß°ÊºAªºUserForm¡A¤Î§Y®É¨M©w³o­Ó°ÊºAªºµøµ¡¸Ì­±ªº±±¨î¶µ¼Æ¥Øªº¦h¤Ö©O¡H
¨Ò¦p¡Aµ{¦¡¦b°õ¦æ¤¤¡A·|§ì¨ú¤£¦P¸ê®Æªº¤H¼Æ¡A¨C¤@­Ó¸ê®Æ°Ï¶ôªº¤H¼Æ¤£¦P¡A­n²£¥Íµøµ¡¨Ó§@¿ï¾Ü¨º¨Ç¤H¬OÁÙ­n«O¯d¦b¸s²Õ¤º¡A¥i¯à²Ä¤@­Ó¸s²Õ¤º¦³4­Ó¦¨­û¡A§Ú»Ý­n¤@­Ó°ÊºAµøµ¡¸Ì­±¦³¥|­Ó¤H¦WªºCheckBox¡AÅý§Ú¿ï¾Ü«O¯d¤U¨Óªº¤H¡A±µ¤U°õ¦æ²Ä¤G¸s²Õ¡A¸Ì­±¥i¯à¦³¤K­Ó¤H¡A¨º´N­n°ÊºA²£«~¤@­Óµøµ¡¡A¸Ì­±¦³¤K­Ó¹ïÀ³ªºCheckBox¡A¥Ñ©óµ{¦¡·|¦]§ì¨ì¸s²Õ§PÂ_¸Ì­±ªº¤H¼Æ¦A¨Ó²£«~¬Û¹ïÀ³¼Æ¶qªºCheckBox¡A³o¼Ëµ{¦¡¦³¿ëªk¼g¶Ü¡HÁٽЦU¦ì°ª¤âµ¹¤©¶}¸Ñ¡A·PÁ±z­Ì
clio

¥»©«³Ì«á¥Ñ jackyq ©ó 2016-3-11 01:05 ½s¿è

¤j¤j¦Û¤v¬ã¨s¬Ý¬Ý
http://stackoverflow.com/questions/10944064/change-individual-listbox-item-font-in-excel

TOP

VBA¬O§_¥i¥H«Ø¥ß°ÊºAUserForm¤Î¸Ì­±¤@±±¨î¶µ¤Î¼Æ¥Ø

½Ð±Ð¦U¦ì°ª¤â¡A¤£ª¾¹DVBA¬O§_¯à«Ø¥ß°ÊºAªºUserForm¡A¤Î§Y®É¨M©w³o­Ó°ÊºAªºµøµ¡¸Ì­±ªº±±¨î¶µ¼Æ¥Øªº¦h¤Ö©O¡H
¨Ò¦p¡Aµ{¦¡°õ¦æ¤¤¡A§Ú¥i¥H¨Ì¾Ú¿é¤Jªº¤Þ¼Æ¡A¨M©w­n¦³´X­ÓCheck Box ¡A´X­ÓOption Button¡A´X­ÓList Box¶Ü¡H·PÁ±z­Ì
clio

TOP

·PÁ±z¡K°£¤F³o­Ó¡A¯à§_¦³¿ëªk¯à¦Û°Ê·s¼W¨ä¥¦ªº±±¨î¶µ¡A¦pOption Button, Check box, Label... µ¥©O¡H
clio

TOP

¦^´_ 3# clio


    Dim TextBox As MSForms.TextBox
Set TextBox = UserForm1.Controls.Add("forms.TextBox.1")
    TextBox.Top = 0

Dim ListBox As MSForms.ListBox
Set ListBox = UserForm1.Controls.Add("forms.ListBox.1")
    ListBox.Top = 30
  
Dim Label As MSForms.Label
Set Label = UserForm1.Controls.Add("forms.Label.1")
    Label.Top = 120
    Label.BorderStyle = fmBorderStyleSingle
    Label.Caption = "13123"

TOP

¥»©«³Ì«á¥Ñ jackyq ©ó 2016-3-15 14:23 ½s¿è

¥Î°ÊºAªº¸Ü
¨Æ¥ó´N³Â·Ð¤F
ÁÙ­n¦h¤@°ï Class ©ÎªÌ¥Î hook
¤~·|«Øij§A¥i¥Hªº¸Ü ¥Î Listbox ´N¦n¤F

TOP

·PÁ¤j¤jªº§iª¾¡A³o¼Ë§Ú´N·|¥Î¤F¡A¥t¥~½Ð±Ð¤@­Ó°ÝÃD¡A¦P²z¬O¤£¬O¤]¥i¥H°ÊºACreate UserForm©O¡A¥i¥H¥Îµ{¦¡ª½±µCreate¤@­Ó·sªºUserForm¶Ü¡H
clio

TOP

' UserForm1 ¥²¶·¨Æ¥ý¤w¸g¦s¦b

Dim F As UserForm1
Dim TextBox As MSForms.TextBox
Dim ListBox As MSForms.ListBox

Set F = New UserForm1
F.Show 0
F.Caption = "Form 1"
Set TextBox = F.Controls.Add("forms.TextBox.1")
    TextBox.Top = 0

Set ListBox = F.Controls.Add("forms.ListBox.1")
    ListBox.Top = 30


Set F = New UserForm1
F.Show 0
F.Top = F.Top + 100
F.Left = F.Left + 100
F.Caption = "Form 2"
Set TextBox = F.Controls.Add("forms.TextBox.1")
    TextBox.Top = 0


Set ListBox = F.Controls.Add("forms.ListBox.1")
    ListBox.Top = 30

TOP

©Ò¥H¤@©w­n¦³¤@­Ó¥ý¦s¦bªºUserForm¡A¦Ó¸Ì­±ªºControls³£¥i¥H¦Û°Ê¥[¡A°ß¦³³Ì¤W¼hªºUserForm¤@©w­n¥ý¦s¦b¡AµLªk¦Û°Ê«Ø¥ß³Ì¤W¼hªºUserForm¡A³o¼Ë»¡¹ï§a
clio

TOP

¦Û°Ê«Ø¥ß UserForm
https://support.microsoft.com/en-us/kb/204330

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD