'创建按钮 Dim BtnName As String Dim Btn As CommandButton Dim BtnSendPay As OLEObject Set BtnSendPay = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, _ DisplayAsIcon:=False, Left:=10, Top:=10, Width:=100, Height:=20).Select
请问我用上面的方法创建按钮后,按钮位置怎么总是在左上角的单元格,而不是当前选定的单元格呢?
smarteyeexit Replied at : 2011-08-15 13:47:00
对了,我一加Select后,还提示我错误 "运行时错误:424" 要求对象
smarteyeexit Replied at : 2011-08-15 14:11:24
顶一下
laoyebin Replied at : 2011-08-15 16:19:21
Left:=10, Top:=10, Width:=100, Height:=20 这个改一下
smarteyeexit Replied at : 2011-08-15 17:05:49
我把left 和 top 取消后,也不行. 另外一加Select ActiveSheet.OLEObjects.Add(...).Select 就提示我错误 "运行时错误:424" 要求对象
'当前位置 Dim bLoc As Range Dim bTop As Single Dim bLeft As Single Dim bHeight As Single Dim bWidth As Single Set bLoc = Range(ActiveCell, ActiveCell) bTop = bLoc.Top bLeft = bLoc.Left bHeight = bLoc.Height bWidth = bLoc.Width