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

½Ð°Ý§Ú³oVBA­þ¸Ì¦³°ÝÃD¡H¬°¤°»ò·|µLªk¥X²{ 424 µLªk§ä¨ìª«¥ó©O?

¦^´_ 4# jeffrey628litw
¸Õ¸Õ¬Ý
  1. Option Explicit                  '±j¨î ¼Ò²ÕªºÅܼƥ²¶·­n Dimªº«Å§i,·|¨Ïµ{¦¡©ö©ó°»¿ù
  2. Dim D As Object, Sh(1 To 2) As Worksheet '¼Ò²Õ³»ºÝ¤W DimªºÅÜ¼Æ ¥i¦bUserForm1ªº¥þ³¡µ{¦¡¤¤¨Ï¥Î
  3. Dim xTempPicture As String
  4. Private Sub UserForm_Initialize()
  5.     Dim A As Range, S As String
  6.     Set D = CreateObject("Scripting.Dictionary")
  7.     Set Sh(1) = ThisWorkbook.Sheets("Database") '¤u§@ªí¦p¦³Åܰʮɦb¦¹­×§ï§Y¥i
  8.     Set Sh(2) = ThisWorkbook.Sheets.Add
  9.     xTempPicture = "D:\IE.jpg"
  10.     ¶×¤J¹Ï¤ù   '¸ü¤Jªí³æµe­±¹Ï¤ù
  11.     With Sh(1)
  12.         For Each A In .Range(.[E2], .[E2].End(xlDown))
  13.             '**************************
  14.             'F10 ,F11 ¦³´«¦æ¦r¤¸ »Ý­×§ï
  15.             '¤j ¨¦µ¾¥­
  16.             'Shohei Ohtan
  17.             '***************************
  18.             S = Replace(Trim(A), vbLf, Space(1)) '´«¦æ¦r¤¸ §ï¦¨ Space(1)
  19.             Set D(S) = Range(A.Offset(, 1).Address)
  20.             'Debug.Print S, D(S).Address  '«ü¥O:À˵ø->¤Î®Éµøµ¡¥i¬Ý¬Ý
  21.         Next
  22.     End With
  23.     ComboBox1.List = D.KEYS
  24.     Label1.WordWrap = False   '¤º®e¦b¦æ¥½¬O§_¦Û°Ê´«¦æ
  25.     With Image1               '³]©w¹Ï¤ùªºÅã¥Ü³]¼Ò¦¡
  26.         .Picture = LoadPicture(xTempPicture)
  27.         .PictureAlignment = fmPictureAlignmentCenter '2
  28.         .PictureSizeMode = fmPictureSizeModeClip     '0
  29.     End With
  30.     With Image2               '³]©w¹Ï¤ùªºÅã¥Ü³]¼Ò¦¡
  31.         .Picture = LoadPicture(xTempPicture)
  32.         .PictureAlignment = fmPictureAlignmentCenter '2
  33.         .PictureSizeMode = fmPictureSizeModeClip     '0
  34.     End With
  35. End Sub
  36. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  37.     Application.DisplayAlerts = False
  38.     Sh(2).Delete
  39.     Kill xTempPicture
  40.     Application.DisplayAlerts = True
  41. End Sub
  42. Private Sub ComboBox1_Change()
  43.     Dim A As Range
  44.     Label1.Caption = "¨S¦³¦¹¹Ï¤ù"
  45.     Image1.Picture = LoadPicture(xTempPicture) 'ªí³æ¹w³]ªº¹Ï¤ù
  46.     Image2.Picture = LoadPicture(xTempPicture) 'ªí³æ¹w³]ªº¹Ï¤ù
  47.     'Image1.Visible = False      '©Î¬OÁôÂÃ
  48.     With ComboBox1
  49.         If .ListIndex = -1 Then Exit Sub
  50.         ¹Ï¤ùÀˬd D(.List(.ListIndex)).Address, Image1
  51.         If ¹Ï¤ùÀˬd(D(.Value).Address, Image1) Then Label1.Caption = ComboBox1
  52.         If .ListIndex < .ListCount - 1 Then ¹Ï¤ùÀˬd D(.List(.ListIndex + 1)).Address, Image2
  53.     End With
  54. End Sub
  55. Private Function ¹Ï¤ùÀˬd(xPicture As String, xImage As Image) As Boolean
  56.     Dim S As Shape, P As Object, xName As String
  57.     For Each S In Sh(1).Shapes
  58.         '*************************************************
  59.         'Shapeª«¥ó¬O·Ó¤ù¥B¦ì¸m¬OD(ComboBox1.Value).Address)
  60.         If S.Type = msoPicture And S.TopLeftCell.Address = xPicture Then
  61.             ¹Ï¤ùÀˬd = True
  62.             Set P = S '.Copy '¹Ï¤ù½Æ»s
  63.             Exit For
  64.         End If
  65.         '***************************************************
  66.     Next
  67.     If ¹Ï¤ùÀˬd = True Then
  68.         xName = "D:\temp.jpg"
  69.         ·Ó¤ùExport P, xName
  70.         xImage.Picture = LoadPicture(xName) 'ªí³æÅã¥Ü¹Ï¤ù
  71.         Kill xName ' "D:\temp.jpg" '§R°£¼È¦s¹Ï¤ù
  72.     End If
  73.     End Function
  74. Private Sub ·Ó¤ùExport(P As Object, xName As String)
  75.     P.Copy
  76.     With Sh(2).ChartObjects.Add(1, 1, P.Width, P.Height) '·s¼W¹Ïªí
  77.         .Chart.Paste '¶K¤W¹Ï¤ù
  78.         .Chart.Export xName '¶×¥X¹Ïªí¡A¼È¦s¹Ï¤ù
  79.         .Delete '§R°£¹Ïªí
  80.      End With
  81. End Sub
  82. Sub ¶×¤J¹Ï¤ù()
  83.     Dim P As Picture
  84.     With Sh(2)
  85.         Set P = .Pictures.Insert("http://forum.twbts.com/templates/discuz6/images/logotop.png") '(¤u§@ªí¤W´¡¤J·Ó¤ù)
  86.         With [a1]                           '«ü©wªºÀx¦s®æ
  87.             P.Top = .Top                    '·Ó¤ùªº¥k¤è¦b¤u§@ªí¤Wªº¦ì¸m
  88.             P.Left = .Left                  '·Ó¤ùªº¥k¤è¦b¤u§@ªí¤Wªº¦ì¸m
  89.             .RowHeight = IIf(P.Height >= 409, 409, P.Height)        '½Õ¾ãÀx¦s®æ°ª«×=>·Ó¤ùªº°ª«×
  90.             P.Height = IIf(P.Height >= 409, 409, P.Height)          '½Õ¾ãÀx¦s®æ°ª«×=>·Ó¤ùªº°ª«×
  91.             If .Width < P.Width * (.ColumnWidth / .Width) Then   '¤U¸ü·Ó¤ùªº³Ì¤j¼e«×
  92.              .Width = P.Width * (.ColumnWidth / .Width)
  93.             .ColumnWidth = P.Width * (.ColumnWidth / .Width)    '½Õ¾ãÀx¦s®æÄæ¼e=>·Ó¤ùªº¼e«×
  94.             End If
  95.        End With
  96.      End With
  97.     ·Ó¤ùExport P, xTempPicture
  98. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  jeffrey628litw

¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2018-6-13 08:26



    ½Ð°Ý§Ú·Q­n«öDisplay Photo«ö¶s«á¡A
    ¤U©Ô¿ï³æ Player Name
     ¿ïMchael  Jordan «á¥i¥H¥X²{
      Image1¡G¬°F2¹Ï®×
       Image2¬°F3¹Ï®×

       Ãþ¦üEBAY ¿z¿ï§¹¦³°}¦C¹Ïªí¡AÃþ¦ü¤U¹Ï



Àɮצb¶³ºÝ  http://webhd.xuite.net/_oops/jeffrey628litw/c6x

TOP

¦^´_ 2# GBKEE


    ÁÂÁ G ¶W¯Åª©¥Dªº¦^ÂСA¥Ø«eµo²{³Ì«á­n¥[ End Function ´N¥i¥HRun¤F¡A¨ä¥LÁÙ¦b¬ã¨s¤¤¡A¶W¯Å·PÁ±zªºÀ°¦£¡C

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-6-13 08:27 ½s¿è

¦^´_ 1# jeffrey628litw

¸Õ¸Õ¬Ý
  1. Option Explicit                  '±j¨î ¼Ò²ÕªºÅܼƥ²¶·­n Dimªº«Å§i,·|¨Ïµ{¦¡©ö©ó°»¿ù
  2. Dim D As Object, Sh As Worksheet '¼Ò²Õ³»ºÝ¤W DimªºÅÜ¼Æ ¥i¦bUserForm1ªº¥þ³¡µ{¦¡¤¤¨Ï¥Î
  3. Private Sub UserForm_Initialize()
  4.     Dim A As Range, S As String
  5.     Set D = CreateObject("Scripting.Dictionary")
  6.     Set Sh = Sheets("Database") '¤u§@ªí¦p¦³Åܰʮɦb¦¹­×§ï§Y¥i
  7.     'With Sheets("Database") ' ©Î¬O With Sheet1
  8.     With Sh
  9.         For Each A In .Range(.[E2], .[E2].End(xlDown))
  10.             '**************************
  11.             'F10 ,F11 ¦³´«¦æ¦r¤¸ »Ý­×§ï
  12.             '¤j ¨¦µ¾¥­
  13.             'Shohei Ohtan
  14.             '***************************
  15.             S = Replace(Trim(A), vbLf, Space(1))  '´«¦æ¦r¤¸ §ï¦¨ Space(1)
  16.             Set D(S) = Range(A.Offset(, 1).Address)
  17.             'Debug.Print S, D(S).Address  '«ü¥O:À˵ø->¤Î®Éµøµ¡¥i¬Ý¬Ý
  18.         Next
  19.     End With
  20.     ComboBox1.List = D.keys
  21.     Label1.WordWrap = False   '¤º®e¦b¦æ¥½¬O§_¦Û°Ê´«¦æ
  22.     With Image1               '³]©w¹Ï¤ùªºÅã¥Ü³]¼Ò¦¡
  23.         .PictureAlignment = fmPictureAlignmentCenter '2
  24.         .PictureSizeMode = fmPictureSizeModeClip     '0
  25.     End With
  26. End Sub
  27. Private Sub ComboBox1_Change()
  28.     Dim A As Range
  29.     Label1.Caption = "¨S¦³¦¹¹Ï¤ù"
  30.     Image1.Picture = LoadPicture("") '¤£Åã¥Ü¹Ï¤ù
  31.     'Image1.Visible = False      '©Î¬OÁôÂÃ
  32.     If ComboBox1.ListIndex = -1 Then Exit Sub
  33.     If ¹Ï¤ùÀˬd(D(ComboBox1.Value).Address) = False Then Exit Sub
  34.     'Image1.Visible = True      'Åã¥Ü
  35. End Sub
  36. Private Function ¹Ï¤ùÀˬd(xPicture As String) As Boolean
  37.     Dim S As Shape, P As Object, xTop As Double
  38.     For Each S In Sh.Shapes
  39.         '*************************************************
  40.         'Shapeª«¥ó¬O·Ó¤ù¥B¦ì¸m¬OD(ComboBox1.Value).Address)
  41.         If S.Type = msoPicture And S.TopLeftCell.Address = xPicture Then
  42.             ¹Ï¤ùÀˬd = True
  43.             S.Copy  '¹Ï¤ù½Æ»s
  44.             Set P = S
  45.             Exit For
  46.         End If
  47.         '***************************************************
  48.     Next
  49.     If ¹Ï¤ùÀˬd = True Then
  50.         With Sh
  51.             Label1.Caption = ComboBox1
  52.             With .ChartObjects.Add(1, 1, P.Width, P.Height) '·s¼W¹Ïªí
  53.                 .Chart.Paste '¶K¤W¹Ï¤ù
  54.                 .Chart.Export "D:\temp.jpg" '¶×¥X¹Ïªí¡A¼È¦s¹Ï¤ù
  55.                 .Delete '§R°£¹Ïªí
  56.             End With
  57.             Image1.Picture = LoadPicture("D:\temp.jpg") 'ªí³æÅã¥Ü¹Ï¤ù
  58.             Kill "D:\temp.jpg" '§R°£¼È¦s¹Ï¤ù
  59.         End With
  60.     End If
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD