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

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

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

¥Ø«e§Úªºµ{¦¡½XºK­n¦p¤U(¥i¥H¦¨¥\°õ¦æ)¡G
              Set myPic = ActiveSheet.Pictures.Insert(myPath & "\" &  "1.jpg")
                With myPic
                    .ShapeRange.LockAspectRatio = msoFalse
                    .Top = picNumRng.Offset(0, 1).Top
                    .Left = picNumRng.Offset(0, 1).Left
                    .Width = picNumRng.Offset(0, 1).MergeArea.Width
                    .Height = picNumRng.Offset(0, 1).MergeArea.Height
                End With
°ÝÃD¦p¤U¡G
1.«á¨Óµo²{Pictures.Insert ¬O§Q¥Î³sµ²¤è¦¡Åª¨ú¤j¶q¹Ï¤ù¡A¨Ã«D±N¹Ï¤ù¶×¤J¨ìexcelÀɤº¡A¤£²Å»Ý¨D
2.¸g¹Lgoogleµo²{ http://blog.xuite.net/crdotlin/excel/9016086  ªº¸Ñªk¡Aª¾¹D¦³Shapes.AddShapeªº¤è¦¡
    ¦ý¬¡­¶¤¤¦³³]­p¤@­Ó«ö¶s¡A¦pªG­n«ü©w¯S©w¹Ï¤ù®É¡A¤]·|±N¸Ó«ö¶sºâ¦¨¤@­ÓShape³y¦¨§xÂZ
3.«á¨Ó¦Aµo²{ https://tw.knowledge.yahoo.com/question/question?qid=1612072502639 ªº¸Ñªk
    ª¾¹DShapes.AddPicture ªº¤è¦¡¡A¥u¬Ogoogle¤Îª¦¤F®a±Úªº¤å³¹¨Ã¨S¦³µo²{¥i¥H°Ñ¦Òªº¤å³¹
    ¦Û¤v¸ÕµÛ±N¤W­zªºµ{¦¡½X¤¤ªºPictures.Insert¥HShapes.AddPicture¨ú¥N«á°õ¦æ¡A¥u¬O¦b¤W­zµ{¦¡½X²Ä¤T¦æ
    ´N·|¥X²{¿ù»~¡A¤£ª¾¹D¦³µL¨ä¥L¤èªk¥i¥H²Å¦X¡u¶×¤J¹Ï¤ù¡v¡B¡u«ü©wÄæ¦ì´¡¤J¡v¤Î¡u½Õ¾ã¹Ï¤ù¤j¤p¡v¡H
4.¥t¥~§ä¨ìªº³o­Ó¤èªk¤]¬O¤£¿ù http://blog.xuite.net/crdotlin/excel/9016086 ¥u¬OµLªk²z¸Ñ«ç»ò°µ
    ¡]¥i¥H±N³sµ²ªº¹Ï¤ù½Æ»s¨ì°Å¶Kï«á¡A¦A§ì¤U¨Ó   ´£¨Ñ°Ñ¦Ò¡^
HELLO !!

¦^´_ 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

¦^´_ 2# GBKEE
·PÁÂGBKEE¤jªº«ü¾É¡A½T¹ê¬O¥i¦æªº¡A¥t¥~©µ¦ù½Ð±Ð¤@­ÓÃö©ó¶×¤J¹Ï¤ùªº°ÝÃD¡G
°²³]§Ú¥ý°õ¦æµ{¦¡¨Ã¡u¨Ì§Ç¡v¶×¤J¤F100±i¹Ï¤ù(°²³]¥ÑB1~B100±Æ¦C)¡A¥B«áÄò¦b²Ä57®æÄæ¦ì¡u·s¼W´¡¤J¡v¥t±i¹Ï¤ù¡A­ì©l¹Ï¤ù§¡¶¶©µ±Æ§Ç¦Ü101®æ
¸g¹ê»Ú°õ¦æ¡A­ì©lªº¹Ï¤ù¹q¸£·|»{©w³o100±iªº¹Ï¤ù¨Ì§Ç¬OShape(1)~Shape(100)¡AÁöµM«áÄò´¡¤J²Ä57±i¹Ï¤ù(¥Ñ¤W©¹¤Uºâ)¡A¦ý·|³Q»{©w¬°Shape(101)
¦]¦¹±µµÛ§Ú·Q¡u§R°£¡v²Ä60±i¹Ï¤ù¡]«ü¥Ñ¤W©¹¤Uºâ¡A¦ý¹q¸£»{©w¸Ó¹Ï¬°Shape(59)¡^¡A¹ê»Ú¤W§R°£ªº¨ä¹ê¬OShape(60)¡A¦Ó¤£¬O§Ú·Q­n§R°£ªºShape(59)
²¨¥¤§
§Ú«ç»ò§JªA¹Ï¤ù©Ò¨£ªº¹ê»Ú¶¶§Ç»P¹Ï¤ù¶×¤J¶¶§Çªº®t§O¡A¥H§Q§Ú«áÄò¦b¾Þ§@«ü©w¹Ï¤ù®Éªº§xÂZ¡H
HELLO !!

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¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD