我在工作簿中使用以下代码
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim MyPicture As Object
Dim MyTop As Double
Dim MyLeft As Double
Dim BottomRightCell As Range
'-----------------------------------------------------------
'- bottom right cell
With ActiveWindow.VisibleRange
r = .Rows.Count
c = .Columns.Count
Set BottomRightCell = .Cells(r, c)
End With
'------------------------------------------------------------
'- position picture
Set MyPicture = ActiveSheet.Pictures(1)
MyTop = BottomRightCell.Top - MyPicture.Height - 5
MyLeft = BottomRightCell.Left - MyPicture.Width - 5
With MyPicture
.Top = MyTop
.Left = MyLeft
End With
End Sub
我收到错误"无法获取图片类的高度属性"而且我不知道为什么。
我在其他工作表中使用了相同的代码并且有效。
有什么想法吗?