標題:
[發問]
EXCEL 刪除所有圖片
[打印本頁]
作者:
whirlwind963
時間:
2012-9-26 15:39
標題:
EXCEL 刪除所有圖片
ActiveSheet.Pictures.Delete
這個指令能刪除工作表裡的所有圖片
但是如何做才能不刪掉工作表的bottom呢
作者:
GBKEE
時間:
2012-9-26 15:54
回復
1#
whirlwind963
工作表的bottom
執行 ActiveSheet.Pictures.Delete 這程式碼
參考這裡 Application.Caller
作者:
whirlwind963
時間:
2012-9-26 16:13
回復
2#
GBKEE
Private Sub CommandButton1_Click()
Macro1
End Sub
Sub Macro1()
Sheets("Sheet1").Select
j = 2
While Cells(j, "C") <> ""
ActiveSheet.Pictures.Delete
NN = Cells(j, "C")
Cells(j, "D").Select
ActiveSheet.Pictures.Insert( _
NN). _
Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 100#
Selection.ShapeRange.Width = 100#
Selection.ShapeRange.Rotation = 0#
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
j = j + 1
Wend
Range("C2").Select
End Sub
請問我的原始碼是上面的
要怎麼辦才能不刪掉bottom呢
作者:
GBKEE
時間:
2012-9-26 16:37
回復
3#
whirlwind963
程式中沒看到刪掉bottom (Shape物件)的程式碼
Sub Macro1()
Sheets("Sheet1").Select
ActiveSheet.Pictures.Delete '在此程式只刪一次照片
j = 2
While Cells(j, "C") <> ""
' ActiveSheet.Pictures.Delete
'在迴圈中一直刪照片 對於後面的Pictures.Insert 有何意義
NN = Cells(j, "C")
Cells(j, "D").Select
ActiveSheet.Pictures.Insert( _
NN). _
Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 100#
Selection.ShapeRange.Width = 100#
Selection.ShapeRange.Rotation = 0#
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
j = j + 1
Wend
Range("C2").Select
End Sub
複製代碼
作者:
whirlwind963
時間:
2012-9-26 16:58
回復
4#
GBKEE
Private Sub CommandButton1_Click()
Macro1
End Sub
我是用buttom執行macro1的
作者:
GBKEE
時間:
2012-9-27 13:05
回復
5#
whirlwind963
你程式中沒看到刪掉bottom (Shape物件)的程式碼
附上檔案看看
作者:
whirlwind963
時間:
2012-9-27 13:25
回復
6#
GBKEE
麻煩幫我看一下
當我按下BUTTOM後
圖片可以刪除
但是BUTTOM也會跟著刪除
作者:
GBKEE
時間:
2012-9-27 15:38
回復
7#
whirlwind963
可參考 這裡
http://forum.twbts.com/viewthread.php?tid=687
Sub Macro1()
Dim E As Shape, j, NN
Sheets("Sheet1").Select
For Each E In ActiveSheet.Shapes
If E.Type = 13 Then E.Delete
'If InStr(E.Name, "Picture") Then E.Delete '這也可以
Next
j = 2
While Cells(j, "C") <> ""
NN = Cells(j, "C")
Cells(j, "D").Select
ActiveSheet.Pictures.Insert( _
NN). _
Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 100#
Selection.ShapeRange.Width = 100#
Selection.ShapeRange.Rotation = 0#
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
j = j + 1
Wend
Range("C2").Select
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)