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

Excel VBA ¦p¦ó¦Û°Ê½Õ¾ãªí³æ¤j¤p

Excel VBA ¦p¦ó¦Û°Ê½Õ¾ãªí³æ¤j¤p

·Q½Ð°Ý¤@¤U¤j¤j
¤§«eVBAªí³æ¼g¦n«á
¥»¨­ªí³æ­n¶ñ¼gªº¤º®e¸û¦h
¥H¥Ø«e¤@¯ë22¦T¿Ã¹õ¬ÝÁÙOK
¦ý¬O´«¨ìµ§¹q¤W­±
µo²{ªí³æ¶}±Ò«á
³Ì¤U­±ªº«öÁä´N«ö¤£¨ì¤F
¦³¿ìªk§Q¥Î·Æ¹«±Nªí³æ¤j¤pµ¥¤ñÁY¤p¶Ü?

¦]¬°§Ú§Q¥Î«öÁäÁY¤p
§ïÅܤFªí³æ¤j¤p
¦ý¬O¤º®e¨S¦³µ¥¤ñÁY¤p
  1. Sub ³]©w¦Û­qªí³æªº¤Ø¤o()
  2. MsgBox ¡§±NUserForm1ªº°ª«×»P¼e«×¦U©ñ¤j1.5­¿¡¨
  3. takasa = UserForm1.Height
  4. haba = UserForm1.Width
  5. UserForm1.Height = takasa * 3/2
  6. UserForm1.Width = haba * 3/2
  7. UserForm1.Show
  8. MsgBox ¡§¦^´_­ì¨Óªºª¬ºA¡¨
  9. UserForm1.Height = takasa
  10. UserForm1.Width = haba
  11. End Sub
½Æ»s¥N½X
¦³¨ä¥L¸Ñ¨M¤è¦¡
¥i¥H¸Ñµª§ÚªººÃ´b©O? ·P¿E¤£ºÉ >//<
Jared

¦^´_ 1# Jared
´£¨Ñ¤@­Ó¤èªk¡A®Ú¾Úªí³æªº½ÆÂø«×¡A®ÄªG¥i¯à¤£¤@©w«Ü¦n¡A¨Ñ§A°Ñ¦Ò¡G
¦b¸Óªí³æªºµ{¦¡½X¥[¤W¤U­±Code¡A¶}±Òªí³æ«á¡A¦bªí³æ¤W«ö¡G
Ctrl+·Æ¹«¥ªÁä©ì¦²¦V¤W¡A¥i©ñ¤jªí³æ
Ctrl+·Æ¹«¥ªÁä©ì¦²¦V¤U¡A¥iÁY¤pªí³æ
  1. Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  2.   Static lastY As Single
  3.   
  4.   If Button = 1 And Shift = 2 Then
  5.     If Y - lastY > 5 Then
  6.       ResizeUserform 1.1
  7.       lastY = Y
  8.     ElseIf lastY - Y > 5 Then
  9.       ResizeUserform 0.9
  10.       lastY = Y
  11.     End If
  12.   End If
  13. End Sub

  14. Private Sub ResizeUserform(dSizeCoeff As Double)
  15.   Dim c  
  16.   With Me
  17.     .Width = .Width * dSizeCoeff
  18.     .Height = .Height * dSizeCoeff
  19.    
  20.     For Each c In .Controls
  21.       With c
  22.         .Top = .Top * dSizeCoeff
  23.         .Left = .Left * dSizeCoeff
  24.         .Width = .Width * dSizeCoeff
  25.         .Height = .Height * dSizeCoeff
  26.         
  27.         On Error Resume Next
  28.         .Font.Size = .Font.Size * dSizeCoeff
  29.         On Error GoTo 0
  30.       End With
  31.     Next
  32.   End With
  33. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# stillfish00
¥[¤W¥iÁÙ­ì(­ì¨Óªº¤j¤p)
  1. Option Explicit
  2. Dim xME()
  3. Private Sub UserForm_Initialize()
  4.     Dim i As Integer, e As Variant
  5.     ReDim xME(0 To Controls.Count)   
  6.     xME(0) = Array(Top, Left, Height, Width, Font.Size)
  7.     For Each e In Controls
  8.         With e
  9.             i = i + 1
  10.             xME(i) = Array(.Top, .Left, .Height, .Width, .Font.Size)
  11.         End With
  12.     Next
  13. End Sub
  14. Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  15.   Dim i As Integer, e As Variant
  16.   Static lastY As Single
  17.   Debug.Print Shift
  18.     If Button = 1 And Shift = 2 Then
  19.         If Y - lastY > 5 Then
  20.             ResizeUserform 1.1
  21.             lastY = Y
  22.         ElseIf lastY - Y > 5 Then
  23.             ResizeUserform 0.9
  24.             lastY = Y
  25.         End If
  26.     ElseIf Button = 2 And Shift = 2 Then    '«ö¤U¥kÁä
  27.         Top = xME(0)(0)
  28.         Left = xME(0)(1)
  29.         Height = xME(0)(2)
  30.         Width = xME(0)(3)
  31.         Font.Size = xME(0)(4)
  32.         For Each e In Controls
  33.             With e
  34.                 i = i + 1
  35.                 .Top = xME(i)(0)
  36.                 .Left = xME(i)(1)
  37.                 .Height = xME(i)(2)
  38.                 .Width = xME(i)(3)
  39.                 .Font.Size = xME(i)(4)
  40.             End With
  41.         Next
  42.     End If
  43. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# GBKEE
¤Ó¦n¤F¡A§ÚÁÙ¤@ª½¦b·Q¾Þ§@¤Ó¦h¦¸¦r«¬¥i¯à·|Åܱ¼¡C
ÁÙ­ì¬O­Ó¦n¥D·N¡I

TOP

¦^´_ 3# GBKEE

·PÁ¡A¹ê¥Î
ss

TOP

¦^´_ 3# GBKEE

·PÁ¤j¤jªºÀ°¦£¡A¤S¾Ç¨ì¤F¤@©Û
Jared

TOP

¦^´_ 2# stillfish00

ªGµMªí³æ¤Ó½ÆÂø¤]¤£¦æ¡A¦ýÁÙ¬O·PÁ¤j¤jÀ°¦£^^
Jared

TOP

¦^´_ 3# GBKEE


    ¸Õ¤F¤@¤U¡A¦pªG­nÁÙ­ì¬O­n«ö­þ­Ó«öÁä¡H>\<
Jared

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-7-19 09:45 ½s¿è

¦^´_ 8# Jared
Shift   
0 (¹s) ¨S¦³Áä
1 SHIFT Áä
2 CTRL Áä
4 ALT Áä
  1. If Button = 1 And Shift = 2 Then    '«ö¤U¥ªÁä +Shift

  2.     ElseIf Button = 2 And Shift = 2 Then    '«ö¤U¥kÁä +Shift
½Æ»s¥N½X
µ{¦¡½X¤£¤F¸Ñ­n¦h¬ÝVBA»¡©ú
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¦¨¥\¬OÀuÂIªºµo´§¡A¥¢±Ñ¬O¯ÊÂIªº²Ö¿n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD