2013-07-31 68 views

回答

1

此處示例演示如何在Excel表單上獲取圖片的左上角和右側單元格。圖片必須被選中。

Sub test() 
    If (VBA.TypeName(Selection) = "Picture") Then 
     Dim pic As Excel.Picture 
     Set pic = Selection 

     Dim topLeft As Range 
     Set topLeft = pic.TopLeftCell 
     Debug.Print topLeft.Address 

     Dim bottomRight As Range 
     Set bottomRight = pic.BottomRightCell 
     Debug.Print bottomRight.Address 
    End If 
End Sub 
+0

謝謝丹,那正是我需要的! –

+0

不客氣! – dee