2013-04-29 162 views
0

工作正如标题所说,当我打电话SetFocus我的文本框,它抛出我这个错误:Excel的VBA的SetFocus在Excel 2013

Run-time error '438':
Object doesn't support this property or method.

SetFocus在Excel 2013现成的或做我需要修补或更新我的Excel的任何组件?

+0

看看这个:http://stackoverflow.com/questions/14507592/excel-set-focus-on-specific-cell-after-pasting – Terry 2013-04-29 09:51:02

+0

我想SetFocus不是一个单元格的文本框。谢谢。 – 2013-04-29 10:00:37

+0

你如何称setfocus?你使用的文本框变量的方法? – Terry 2013-04-29 10:16:09

回答

0

我认为Setfocus()可能永远不会抛出这样的错误!


Object doesn't support this property or method (Error 438)

This method or property does not exist for this OLE automation object. See the object's documentation for more information on the object and to check the spellings of properties and methods.

这里有一个方法SetFocus(),所以你需要知道当这种方法不存在


在Office 2013,如果对象或其容器之一是不可见或启用,它抛出这个错误:

Run-time error '2110':
Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.


正如我测试通过提高Enter Event使循环也不要“T抛出的错误,也是使用类似的方法SetFocus()

Private Sub TextBox1_Enter() 
    TextBox2.SetFocus 
End Sub 

Private Sub TextBox2_Enter() 
    TextBox1.SetFocus 
End Sub 

我无法想出任何其他原因!