- 帖子
- 2035
- 主題
- 24
- 精華
- 0
- 積分
- 2031
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 100
- 性別
- 男
- 註冊時間
- 2012-3-22
- 最後登錄
- 2024-2-1
|
5#
發表於 2016-4-12 06:41
| 只看該作者
可以省略theTextBox
直接Set AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True ...
linyancheng 發表於 2016-4-11 13:30 
此處絕對不可以偷懶將 theTextBox 省略,
如果予以省略成:- ' Set theTextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
- ' Set AA(I).C_TextBox = theTextBox
- Set AA(I).C_TextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
複製代碼 接下來的執行將會出現- 執行階段錯誤 91:
- 沒有設定物件變數或 With 區塊變數
複製代碼 所以 GBKEE 大大原本的設定與考量是正確無誤誤的:- Set theTextBox = Me.Controls.Add("Forms.TextBox.1", "TextBox" & I, True)
- Set AA(I).C_TextBox = theTextBox
- With theTextBox
- .
- .
- End With
複製代碼 |
|