2013-04-29 56 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 

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