¦U¦ì¤j¤j¡A½Ð°ÝUserFormªí³æ¦p¦óŪ¨ú¤lªí³æ
- ©«¤l
- 51
- ¥DÃD
- 11
- ºëµØ
- 0
- ¿n¤À
- 110
- ÂI¦W
- 0
- §@·~¨t²Î
- win 10
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2017-7-15
- ³Ì«áµn¿ý
- 2024-10-27
|
¦U¦ì¤j¤j¡A½Ð°ÝUserFormªí³æ¦p¦óŪ¨ú¤lªí³æ
¦U¦ì¤j¤j¡A½Ð¦U¦ìÀ°¦£¦buserform1ÂI¿ïtextbox1¤¤¦Û°Ê¼u¥XUserForm2
¿ï¾Ü¤é´Á«á¦Û°Ê¶ñ¦^textbox1 |
-
-
test001.rar
(24.51 KB)
|
|
|
|
|
|
- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-12-27 11:10 ½s¿è
¦A¦¸ÁÂÁ 㴣³¡ªL«e½ú«ü¾É
«ö¶sµù¸Ñ:
«ö«ö¶s«áµ²ªG:
Private Sub Build_Calendar()
Dim Y0 As Date, Y1 As Date, Y2 As Date, Y3 As Date, Fb, Fc, Fu, Fs, Bc
'¡ô«Å§iÅܼÆ:(Y0,Y1,Y2,Y3)¬O¤é´ÁÅܼÆ,¨ä¥L¬O³q¥Î«¬ÅܼÆ
Y1 = DateSerial(CB_Yr, CB_Mth.ListIndex + 1, 1)
'¡ô¥OY1³o¤é´ÁÅܼƬO DateSerial(yyyy,m,d) ²Õ¦X¥X·Qnªº¦è¤¸¦~/¤ë/¤é(yyyy/m/d)(¤ëªì¤é)
'CB_Mth.ListIndex + 1 ªº·N«ä¥Î²qªº:CB_Mth¤U©Ô¦¡²M³æ¤è¶ôÅã¥ÜÈ©Ò¦bªº²M³æ¯Á¤Þ¦ì¸m,¦Ó¨ä²M³æ¯Á¤Þ¬O0~11 (²qªº!)
'DateSerial ¨ç¼Æ
'https://learn.microsoft.com/zh-tw/office/vba/language/reference/user-interface-help/dateserial-function
'ListIndex ÄÝ©Ê,ÃѧO ListBox ©Î ComboBox ¤¤¥Ø«e¿ï¨úªº±M®×¡C
'https://learn.microsoft.com/zh-tw/office/vba/language/reference/user-interface-help/listindex-property
Y2 = DateAdd("m", 1, Y1) - 1
'¡ô¥OY2³o¤é´ÁÅܼƬO DateAdd(m´«ºâªº¤Ñ¼Æ:28¡B29¡B30©Î31,1m,Y1ÅܼƤé´Á¬°°ò·Ç¤é)(yyyy/m/d)(¤ë§À¤é)
'https://learn.microsoft.com/zh-tw/office/vba/language/reference/user-interface-help/dateadd-function
Y0 = Y1 - (Y1 - 1) Mod 7
'¡ô¥OY0¬O [Y1ÅܼÆ(¤ëªì¤é) - Y1ÅܼÆ(¤ëªì¤é)ªº«e¤@¤Ñ °£7 ªº¾l¼Æ(¥ý°£¥X¾l¼Æ¦A¬Û´î)] ªº¤é´Á
'³o¬Onºâ¤ë¾äªº²Ä¤@¤Ñ
For i = 1 To 42
'¡ô³]¶¶°j°é!i±q1¨ì42
Y3 = Y0 + i - 1
'¡ô¥OY3³o¤é´ÁÅܼƬO ¤ë¾äªº²Ä¤@¤Ñ+i°j°é¼Æ -1
Fb = True
'¡ô¥OFb³o³q¥ÎÅܼƬO ¥¬ªLÈ True
Fs = 12
'¡ô¥OFs³o³q¥ÎÅܼƬO 12
Fu = False
'¡ô¥OFu³o³q¥ÎÅܼƬO ¥¬ªLÈ False
Fc = &H80000012
'¡ô¥OFu³o³q¥ÎÅܼƬO Windows «ö¶s¤Wªº¤å¦rÃC¦â¥N¸¹
'¨t²ÎÃC¦â±`¶q
'·j´M VBA ¨t²ÎÃC¦â±`¶q
Bc = &H8000000F
'¡ô¥OBc¬O BackColor ÄݩʪºÈ³]©w¬° Windows ªí³æ¤¤ªº¹w³]È
'https://learn.microsoft.com/zh-tw/office/vba/api/visio.viewer.backcolor
If Y3 Mod 7 < 2 Then Fc = &HFF
'¡ô¦pªGY3¤é´ÁÅܼư£7«áªº¾l¼Æ <2 ,´N¥OFu³o³q¥ÎÅܼƬO 255
'https://learn.microsoft.com/zh-tw/office/vba/language/reference/user-interface-help/hex-function
If Y3 < Y1 Or Y3 > Y2 Then
'¡ô¦pªGY3¤é´ÁÅÜ¼Æ < Y1¤é´ÁÅܼÆ(¤ëªì¤é) ©Î Y3¤é´ÁÅÜ¼Æ >Y1¤é´ÁÅܼÆ(¤ë§À¤é),
Fb = False
'¡ô¥OFb³o³q¥ÎÅܼƬO ¥¬ªLÈ False
Fu = True
'¡ô¥OFu³o³q¥ÎÅܼƬO ¥¬ªLÈ True
Fs = 11
'¡ô¥OFs³o³q¥ÎÅܼƬO 11
Bc = &H808080
'¡ô¥OBc³o³q¥ÎÅܼƬO Windows ¨t²ÎÃC¦â¥N¸¹(¦Ç¦âªº)
End If
With UserForm2("D" & i)
'¡ô¥H¤U¬OÃö©óUserForm2 42Ó¤é´Á«ö¶sªºµ{§Ç
.Font.Bold = Fb '²ÊÅé
.Font.Size = Fs '¦rÅé¤j¤p
.Font.Underline = Fu '«D¥»¤ë-¥[©³½u
.ForeColor = Fc '¦rÅéÃC¦â
.BackColor = Bc 'I´ºÃC¦â
.Caption = Day(Y3)
'¡ô¥O«ö¶sÅã¥Ü¤å¦r¬O Day()Â^¨úY3¤é´ÁÅÜ¼Æ ¤é¼Æ¦r
.ControlTipText = Format(Y3, "yyyy/mm/dd")
'¡ô¥O«ö¶sµù¸Ñ¬O Y3¤é´ÁÅܼƥH yyyy/mm/dd Åã¥Ü
'ControlTipText ÄÝ©Ê
'https://learn.microsoft.com/zh-tw/office/vba/language/reference/user-interface-help/controltiptext-property
End With
Next i
UserForm2.Caption = " " & CB_Yr.Value & "¦~" & CB_Mth.Text
'¡ô¥OUserForm2¼ÐÃD¬O ªÅ¥Õ¦r¤¸³s±µ CB_Yr¤U©Ô¦¡²M³æ¤è¶ôȳs±µ "¦~" ,³Ì«á³s±µ CB_Mth¤U©Ô¦¡²M³æ¤è¶ôÈ
End Sub
Sub ¬Û¤Ïªº_¤Q¤»¶i¦ì()
MsgBox &HFF
MsgBox &HA
MsgBox &HAA
End Sub
Private Sub D1_Click()
xDate = D1.ControlTipText
'¡ô³o¸ÌxDate = D2.ControlTipText »Ýn§ï¬°,xDate = D1.ControlTipText
Unload Me
End Sub
~~~
Private Sub D42_Click()
xDate = D42.ControlTipText
Unload Me
End Sub |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤l
- 13
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 63
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 365
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2022-2-1
- ³Ì«áµn¿ý
- 2024-11-20
|
¥»©«³Ì«á¥Ñ lee88 ©ó 2022-12-26 15:17 ½s¿è
¦^´_ 6# wsx1130
¾ã²z¤@¤Uµ{¦¡½X
UserForm1ªºµ{¦¡½X- Option Explicit
- Private Sub UserForm_Initialize()
- With TextBox1
- .Width = 100
- .Font.Size = 12
- .Font.Bold = True
- End With
- End Sub
- Private Sub UserForm_Activate()
- If UserForm2.Visible = False Then MsgBox "«ö¤Uªí³æ ©I¥s ¤é´Áªí³æ"
- End Sub
- Private Sub UserForm_Click()
- If UserForm2.Visible = False Then UserForm2.Show 0
- End Sub
- Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
- If UserForm2.Visible = True Then Unload UserForm2
- End Sub
½Æ»s¥N½X UserForm1ªºµ{¦¡½X- Option Explicit
- Public Thisday As Date
- Dim CreateCal As Boolean, i As Integer
- Dim Form_Button(1 To 42) As New Class1 '·sªºª«¥ó¼Ò²Õ
- Private Sub UserForm_Initialize()
- Thisday = Date
- For i = 1 To 12
- CB_Mth.AddItem Format(DateSerial(Year(Thisday), i, 1), "m¤ë mmmm")
- Next
- CB_Mth.Value = CB_Mth.List(Month(Thisday) - 1)
- For i = 1980 To 2099 ' PC¤º«Ø¤é´Á¦~«×
- CB_Yr.AddItem i
- Next
- CB_Yr.Value = Year(Thisday)
- Make_com
- CreateCal = True
- Call Build_Calendar
- Application.EnableEvents = True
- End Sub
- Sub Make_com()
- For i = 1 To 42
- Set Form_Button(i).C_Button = Controls("d" & i) '±Nªí³æªº±±¨î¶µ ¾É¤J¬°ª«¥ó¼Ò²Õªº±±¨î¶µ
- Next
- End Sub
- Private Sub CB_Mth_Change()
- 'rebuilds the calendar when the month is changed by the user
- Build_Calendar
- End Sub
- Private Sub CB_Yr_Change()
- 'rebuilds the calendar when the year is changed by the user
- Build_Calendar
- End Sub
- Private Sub Build_Calendar()
- 'the routine that actually builds the calendar each time
- Dim S_Day As Date, Msg As Boolean
- If CreateCal = False Then Exit Sub
- UserForm2.Caption = " " & CB_Mth.Value & " " & CB_Yr.Value
- S_Day = DateSerial(CB_Yr, CB_Mth.ListIndex + 1, 1) - Weekday(DateSerial(CB_Yr, CB_Mth.ListIndex + 1, 1), vbMonday)
- 'S_Day = 42Ó«öÁ䪺²Ä¤@¤Ñ
- For i = 1 To 42
- Msg = Month(S_Day + i - 1) = CB_Mth.ListIndex + 1
- With Controls("d" & i)
- .ControlTipText = S_Day + i - 1
- .Caption = Day(S_Day + i - 1) '«ü©w¤é´Á
- .Font.Bold = Msg ' True '<-©w²ÊÅé
- .ForeColor = IIf(Msg, vbBlack, vbWhite) 'Fc '¦rÅéÃC¦â
- .ForeColor = IIf(Weekday(.ControlTipText) > 6 Or Weekday(.ControlTipText) = 1, vbRed, IIf(Msg, vbBlack, vbWhite))
- .BackColor = IIf(Msg, vbCyan, vbBlack) 'I´ºÃC¦â
- End With
- Next
- End Sub
- Private Sub UserForm_RemoveControl(ByVal Control As MSForms.Control)
- Unload Me
- End Sub
½Æ»s¥N½X **¶·¦b±M®×µøµ¡¥[¤W¤@Ó ª«¥óÃþ§O¼Ò²Õ ·|¦Û°Ê©R¦W¬°Class1(¦WºÙ¥iקï)
Class1ªºµ{¦¡½X- Option Explicit
- Public WithEvents C_Button As MSForms.CommandButton
- Private Sub C_Button_Click()
- With C_Button.Parent.Parent.Parent
- ' 42Ó«öÁ䪺.Parent = Frame1->Frame1.Parent=.Frame2->Frame2.Parent=UserForm2
- .Thisday = C_Button.ControlTipText
- UserForm1.TextBox1 = .Thisday
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 51
- ¥DÃD
- 11
- ºëµØ
- 0
- ¿n¤À
- 110
- ÂI¦W
- 0
- §@·~¨t²Î
- win 10
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2017-7-15
- ³Ì«áµn¿ý
- 2024-10-27
|
¦^´_ 5# ã´£³¡ªL
·PÁ¦U¦ì°ª¤âªºÀ°¦£¡Aªº½T¬O§Únªº®ÄªG
ÁÂÁÂ |
|
|
|
|
|
|
- ©«¤l
- 2834
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2890
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-23
|
¤ë¾ä¤£¶·¨º»ò½ÆÂø//¥unºâ¥X¨C¤ë1¤é¬O¬P´Á´X, ¦A¤Ï±À¨º©Pªº¬P´Á¤é¬Oþ¤@¤Ñ//
Xl0000351-1.rar (19.61 KB)
Yn¥[¤J¥xÆW³s°²¤Î¸É¯Z¤é, ÁÙ¶·¦A¥[Ó¹ï·Óªí(¤H¤u--¨S®É¶¡°µ), ¦A¥Î¦r¨å¦s¨ú~~ |
|
|
|
|
|
|
¡@¼ÊºÙ: ÀH·ÄÆ¿ºªº¦Ð¤ò ¡@ÀY»Î: [±s¥Î]¼ç¤ô¸¥
°ª¤¤¥Í
- ©«¤l
- 852
- ¥DÃD
- 79
- ºëµØ
- 0
- ¿n¤À
- 918
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7 , XP
- ³nÅ骩¥»
- Office 2007, Office 2003,Office 2010,YoZo Office
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¦t©z
- µù¥U®É¶¡
- 2011-4-8
- ³Ì«áµn¿ý
- 2024-2-21
|
¦^´_ wsx1130
¤é´Á¿ï¾Ü¾¹¬O´X¦~«e¼gªº
·í®É¤£¤Ó·|¼g ³£¬Oµw·F ¤@¦æ¤@¦æµwïÈ
§A¤]¥i¥H¨Ï¥Î·Pı ...
singo1232001 µoªí©ó 2022-12-25 10:59
°ÆÀɦWxlsm... ¥¨¶°¼Ò¦¡
¨ä¹ê¤£¥Î§ï¤]¥i¶}±Ò(¦ý 2003 ·|µLªkÃѧO xlsmÀÉ®×) |
|
¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~
¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk
¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¦^´_ 1# wsx1130
¤é´Á¿ï¾Ü¾¹¬O´X¦~«e¼gªº
·í®É¤£¤Ó·|¼g ³£¬Oµw·F ¤@¦æ¤@¦æµwïÈ
§A¤]¥i¥H¨Ï¥Î·Pı¬Ý¬Ý
¹ê¥Î©ÊÀ³¸Ó¤£¿ù
¦ý¬ü¤Æ0¤À
¥t¥~´£¤@ÂI ¦n¹³²{¦bªºÀÉ®× ³£n§ïÀɦW¥t¦s·sÀɤ~¯à¶} ¤£ª¾¹D¬O¤£¬O·L³n¥¨¶°·ÀI¤S§ï¤F |
|
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¥»©«³Ì«á¥Ñ singo1232001 ©ó 2022-12-25 10:51 ½s¿è
¦^´_ 1# wsx1130
v1¸òv2³£¤@¼Ë ¥u¬O®t¦b¼gªk¤£¦P
v3¦³§â¤é´Áªº ¦~¤ë¤éÂ\©ñ¶¶§Ç ½Õ¾ã¦¨¤@¯ë±`¥Î®æ¦¡ |
-
-
test v1.zip
(34.63 KB)
-
-
test v2.zip
(43.43 KB)
-
-
test v3.zip
(44.03 KB)
|
|
|
|
|
|