object不支持此属性或方法vba

时间:2016-01-15 17:11:02

标签: excel vba

任何人都可以告诉我为什么这些行:

Sheets("Order").Cells(orderNum, 1).Value = box.Object.Caption
Sheets("Order").Cells(orderNum, 2).Value = box.Object.GroupName

导致错误“对象不支持此属性或方法”?它们对我来说似乎非常简单。

以下是更多代码:

For Each box In OLEObjects

box.Object.BackColor = RGB(220, 230, 241)

CommandButton1.BackColor = RGB(240, 240, 240)
CommandButton2.BackColor = RGB(240, 240, 240)

TextBox1.BackColor = RGB(255, 255, 255)
TextBox2.BackColor = RGB(255, 255, 255)

'There is a very long If statement here that I'm fairly certain isn't relevant

Sheets("Order").Cells(orderNum, 1).Value = box.Object.Caption
Sheets("Order").Cells(orderNum, 2).Value = box.Object.GroupName

orderNum = orderNum + 1

Next

0 个答案:

没有答案