Pictures.Insert¡BShapes.AddShape¡BShapes.AddPicture®t§O ½Ð°ª¤â«üÂI
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 1# baconbacons
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex_Shapes()
- Dim i As Integer, E As String, S As Shape, Rng As Range
- With ActiveSheet
- .Shapes.SelectAll '¿ï©w Shapeª«¥óªº¶°¦X
- Selection.Delete '§R°£ ©Ò¦³Shapeª«¥ó
- For i = 0 To 9
- E = "http://forum.twbts.com/uc_server/avatar.php?uid=16665&size=middle"
- If i Mod 2 <> 0 Then E = "http://forum.twbts.com/uc_server/avatar.php?uid=16&size=middle"
- With .Range("A1").Offset(i * 6)
- With ActiveSheet.Shapes.AddShape(i + 1, .Left, .Top, .Cells.Resize(, 5).Width, .Cells.Resize(5).Height)
- .Fill.UserPicture E
- End With
- With .Offset(, 10)
- ActiveSheet.Shapes.AddPicture E, True, True, .Left, .Top, .Cells.Resize(, 5).Width, .Cells.Resize(5).Height
- End With
- End With
- Next
-
- '·s¼W«ö¶s
- Set Rng = .Range("A1").Offset(, 7)
- .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
-
- ' ¬¡¶¤¤¦³³]p¤@Ó«ö¶s¡A¦pªGn«ü©w¯S©w¹Ï¤ù®É¡A¤]·|±N¸Ó«ö¶sºâ¦¨¤@ÓShape³y¦¨§xÂZ
- '¬d¬Ý«ö¶s .Type, .Name, .AutoShapeType
- For Each S In ActiveSheet.Shapes
- Debug.Print S.Type, S.Name, S.AutoShapeType
- If S.Type = 12 Then MsgBox S.Name
- Next
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 3# baconbacons - Option Explicit
- Const xP_First = "B3" '«ü©w²Ä£¸±i¹Ï¤ùªº¦ì¸m
- Const xP_Width = 5 '¹Ï¤ùªº¼e«×:¹Ï¤ùªº¦ì¸mÀx¦s®æÂX¥RªºÄæ¼Æ
- Const xP_Height = 5 '¹Ï¤ùªº°ª«×:¹Ï¤ùªº¦ì¸mÀx¦s®æÂX¥Rªº¦C¼Æ
- Const xP_¶¡¹j¦C = 6 '¹Ï¤ù¶¡ªº¶¡¹j¦C¼Æ
- Dim d As Object
- Sub Ex_¹Ï¤ù´¡¤J()
- Dim E As String, Rng As Range, Position As Integer, R As Integer
- xP_Seat
- With ActiveSheet
- If d.Count > 0 Then
- On Error Resume Next
- Position = InputBox("¥»¶p¦³ " & d.Count & " ·Ó¤ù", "«ü©w¦ì¸m", d.Count + 1)
- On Error GoTo 0
- If Position = 0 Then Exit Sub
- If Position <= d.Count Then
- Position = Position - 1
- Else
- Position = d.Count
- End If
- Else
- If MsgBox("·s¼W¹Ï¤ù !!", vbDefaultButton1 + vbYesNo) = vbYes Then
- Position = 0
- Else
- Exit Sub
- End If
- End If
- If d.Count > 0 Then
- For R = d.Count To Position + 1 Step -1 '¥Ñ¤U©¹¤W²¾°Ê¹Ï¤ù¨ì¤U±
- d(R).Top = d(R).TopLeftCell.Offset(xP_¶¡¹j¦C).Top
- Set d(R + 1) = d(R)
- Next
- End If
- R = .Range(xP_First).Row
- With .Range(xP_First).Offset(Position * xP_¶¡¹j¦C)
- If Position Mod 2 = 0 Then
- E = "http://forum.twbts.com/templates/discuz6/images/logotop.gif"
- Else
- E = "http://forum.twbts.com/uc_server/avatar.php?uid=16665&size=middle"
- End If
- With ActiveSheet.Shapes.AddPicture(E, True, True, .Left, .Top, .Resize(, xP_Width).Width, .Resize(xP_Height).Height)
- .Fill.UserPicture E
- Set d(Int((.TopLeftCell.Row - R) / xP_¶¡¹j¦C) + 1) = .OLEFormat.Object
- End With
- End With
- End With
- End Sub
- Sub Ex_¹Ï¤ù§R°£()
- Dim E As String, Rng As Range, Position As Integer, R As Integer
- xP_Seat
- With ActiveSheet
- If d.Count = 0 Then
- MsgBox "¨S¦³¹Ï¤ù¥i§R°£ !!"
- Exit Sub
- End If
- On Error Resume Next
- Position = InputBox("¥»¶p¦³ " & d.Count & " ·Ó¤ù" & vbLf & "¼Æ¦r¦p > " & d.Count & " ¬°§R°£©Ò¦³¹Ï¤ù", "§R°£¦ì¸m", d.Count)
- On Error GoTo 0
- If Position = 0 Then Exit Sub
- If Position > d.Count Then
- If MsgBox("§R°£©Ò¦³¹Ï¤ù !!", vbDefaultButton1 + vbYesNo) = vbYes Then xP_All_Delete
- Exit Sub
- End If
- d(Position).Delete
- For R = Position + 1 To d.Count '¥Ñ¤W©¹¤U²¾°Ê¹Ï¤ù¨ì¤W±
- d(R).Top = d(R).TopLeftCell.Offset(-xP_¶¡¹j¦C).Top
- Set d(R - 1) = d(R)
- Next
- d.Remove (d.Count)
-
- End With
- End Sub
- Private Sub xP_Seat() '¦rÂIª«¥ó: ¾É¤J¹Ï¤ùÄæ¦b«ü©wÄ檺·Ó¤ù
- Dim S As Shape, Rng As Range, R As Integer
- Set d = CreateObject("scripting.dictionary")
- With ActiveSheet
- With .Range(xP_First)
- Set Rng = .EntireColumn
- R = .Row
- End With
- For Each S In .Shapes
- If Not Intersect(Rng, S.TopLeftCell) Is Nothing Then '¹Ï¤ùTopLeftCell¬O¦bxP_First©Ò¦bªºÄæ
- Set d(Int((S.TopLeftCell.Row - R) / xP_¶¡¹j¦C) + 1) = S.OLEFormat.Object
- End If
- Next
- End With
- End Sub
- Private Sub xP_All_Delete() '§R°£¦ì¸m¦b(xP_First = "B1")Äæ©Ò¦³¹Ï¤ù
- Dim S As Shape, Rng As Range
- Set d = CreateObject("scripting.dictionary")
- With ActiveSheet
- Set Rng = .Range(xP_First).EntireColumn
- For Each S In .Shapes
- If Not Intersect(Rng, S.TopLeftCell) Is Nothing Then S.Delete
- Next
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|