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

Pictures.Insert¡BShapes.AddShape¡BShapes.AddPicture®t§O ½Ð°ª¤â«üÂI

¦^´_ 1# baconbacons

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex_Shapes()
  3.     Dim i As Integer, E As String, S As Shape, Rng As Range
  4.     With ActiveSheet
  5.         .Shapes.SelectAll '¿ï©w Shapeª«¥óªº¶°¦X
  6.         Selection.Delete   '§R°£ ©Ò¦³Shapeª«¥ó
  7.         For i = 0 To 9
  8.             E = "http://forum.twbts.com/uc_server/avatar.php?uid=16665&size=middle"
  9.             If i Mod 2 <> 0 Then E = "http://forum.twbts.com/uc_server/avatar.php?uid=16&size=middle"
  10.             With .Range("A1").Offset(i * 6)
  11.                 With ActiveSheet.Shapes.AddShape(i + 1, .Left, .Top, .Cells.Resize(, 5).Width, .Cells.Resize(5).Height)
  12.                     .Fill.UserPicture E
  13.                 End With
  14.                 With .Offset(, 10)
  15.                     ActiveSheet.Shapes.AddPicture E, True, True, .Left, .Top, .Cells.Resize(, 5).Width, .Cells.Resize(5).Height
  16.                 End With
  17.             End With
  18.         Next
  19.         
  20.         '·s¼W«ö¶s
  21.         Set Rng = .Range("A1").Offset(, 7)
  22.         .OLEObjects.Add ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=True, Left:=Rng.Left, Top:=Rng.Top, Width:=Rng.Resize(, 2).Width, Height:=Rng.Resize(2).Height
  23.         
  24.         ' ¬¡­¶¤¤¦³³]­p¤@­Ó«ö¶s¡A¦pªG­n«ü©w¯S©w¹Ï¤ù®É¡A¤]·|±N¸Ó«ö¶sºâ¦¨¤@­ÓShape³y¦¨§xÂZ
  25.         '¬d¬Ý«ö¶s .Type, .Name, .AutoShapeType
  26.         For Each S In ActiveSheet.Shapes
  27.             Debug.Print S.Type, S.Name, S.AutoShapeType
  28.             If S.Type = 12 Then MsgBox S.Name
  29.         Next
  30.     End With
  31. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# baconbacons
  1. Option Explicit
  2. Const xP_First = "B3"   '«ü©w²Ä£¸±i¹Ï¤ùªº¦ì¸m
  3. Const xP_Width = 5      '¹Ï¤ùªº¼e«×:¹Ï¤ùªº¦ì¸mÀx¦s®æÂX¥RªºÄæ¼Æ
  4. Const xP_Height = 5     '¹Ï¤ùªº°ª«×:¹Ï¤ùªº¦ì¸mÀx¦s®æÂX¥Rªº¦C¼Æ
  5. Const xP_¶¡¹j¦C = 6     '¹Ï¤ù¶¡ªº¶¡¹j¦C¼Æ
  6. Dim d As Object
  7. Sub Ex_¹Ï¤ù´¡¤J()
  8.     Dim E As String, Rng As Range, Position As Integer, R As Integer
  9.     xP_Seat
  10.     With ActiveSheet
  11.         If d.Count > 0 Then
  12.             On Error Resume Next
  13.             Position = InputBox("¥»­¶­p¦³ " & d.Count & " ·Ó¤ù", "«ü©w¦ì¸m", d.Count + 1)
  14.             On Error GoTo 0
  15.             If Position = 0 Then Exit Sub
  16.              If Position <= d.Count Then
  17.                 Position = Position - 1
  18.             Else
  19.                 Position = d.Count
  20.             End If
  21.         Else
  22.             If MsgBox("·s¼W¹Ï¤ù !!", vbDefaultButton1 + vbYesNo) = vbYes Then
  23.                 Position = 0
  24.             Else
  25.                 Exit Sub
  26.             End If
  27.         End If
  28.         If d.Count > 0 Then
  29.             For R = d.Count To Position + 1 Step -1   '¥Ñ¤U©¹¤W²¾°Ê¹Ï¤ù¨ì¤U­±
  30.                 d(R).Top = d(R).TopLeftCell.Offset(xP_¶¡¹j¦C).Top
  31.                 Set d(R + 1) = d(R)
  32.         Next
  33.         End If
  34.         R = .Range(xP_First).Row
  35.         With .Range(xP_First).Offset(Position * xP_¶¡¹j¦C)
  36.             If Position Mod 2 = 0 Then
  37.                 E = "http://forum.twbts.com/templates/discuz6/images/logotop.gif"
  38.             Else
  39.                 E = "http://forum.twbts.com/uc_server/avatar.php?uid=16665&size=middle"
  40.             End If
  41.             With ActiveSheet.Shapes.AddPicture(E, True, True, .Left, .Top, .Resize(, xP_Width).Width, .Resize(xP_Height).Height)
  42.                     .Fill.UserPicture E
  43.                     Set d(Int((.TopLeftCell.Row - R) / xP_¶¡¹j¦C) + 1) = .OLEFormat.Object
  44.                 End With
  45.             End With
  46.     End With
  47. End Sub
  48. Sub Ex_¹Ï¤ù§R°£()
  49.     Dim E As String, Rng As Range, Position As Integer, R As Integer
  50.     xP_Seat
  51.     With ActiveSheet
  52.         If d.Count = 0 Then
  53.             MsgBox "¨S¦³¹Ï¤ù¥i§R°£ !!"
  54.             Exit Sub
  55.         End If
  56.         On Error Resume Next
  57.         Position = InputBox("¥»­¶­p¦³ " & d.Count & " ·Ó¤ù" & vbLf & "¼Æ¦r¦p > " & d.Count & " ¬°§R°£©Ò¦³¹Ï¤ù", "§R°£¦ì¸m", d.Count)
  58.         On Error GoTo 0
  59.         If Position = 0 Then Exit Sub
  60.         If Position > d.Count Then
  61.             If MsgBox("§R°£©Ò¦³¹Ï¤ù !!", vbDefaultButton1 + vbYesNo) = vbYes Then xP_All_Delete
  62.             Exit Sub
  63.         End If
  64.         d(Position).Delete
  65.         For R = Position + 1 To d.Count '¥Ñ¤W©¹¤U²¾°Ê¹Ï¤ù¨ì¤W­±
  66.                 d(R).Top = d(R).TopLeftCell.Offset(-xP_¶¡¹j¦C).Top
  67.                 Set d(R - 1) = d(R)
  68.         Next
  69.         d.Remove (d.Count)
  70.         
  71.     End With
  72. End Sub
  73. Private Sub xP_Seat() '¦rÂIª«¥ó: ¾É¤J¹Ï¤ùÄæ¦b«ü©wÄ檺·Ó¤ù
  74.     Dim S As Shape, Rng As Range, R As Integer
  75.     Set d = CreateObject("scripting.dictionary")
  76.     With ActiveSheet
  77.        With .Range(xP_First)
  78.             Set Rng = .EntireColumn
  79.             R = .Row
  80.         End With
  81.         For Each S In .Shapes
  82.             If Not Intersect(Rng, S.TopLeftCell) Is Nothing Then '¹Ï¤ùTopLeftCell¬O¦bxP_First©Ò¦bªºÄæ
  83.                 Set d(Int((S.TopLeftCell.Row - R) / xP_¶¡¹j¦C) + 1) = S.OLEFormat.Object
  84.             End If
  85.         Next
  86.     End With
  87. End Sub
  88. Private Sub xP_All_Delete() '§R°£¦ì¸m¦b(xP_First = "B1")Äæ©Ò¦³¹Ï¤ù
  89.     Dim S As Shape, Rng As Range
  90.     Set d = CreateObject("scripting.dictionary")
  91.     With ActiveSheet
  92.         Set Rng = .Range(xP_First).EntireColumn
  93.         For Each S In .Shapes
  94.             If Not Intersect(Rng, S.TopLeftCell) Is Nothing Then S.Delete
  95.         Next
  96.     End With
  97. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¬°¤H³B¥@­n¤p¤ß²Ó¤ß¡A¦ý¤£­n¡u¤p¤ß²´¡v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD