无法获取oleobject类的对象属性 [英] unable to get object property of oleobject class
问题描述
我正在尝试将Excel项目从Office 2003迁移到Office 2010,但我不断遇到错误,并试图解决它们,但我并没有看到这样的错误:
I'm trying to migrate an excel project from office 2003 to office 2010, and I keep hitting errors, trying to resolve them I'm not at an error that reads:
Unable to get Object Property of OleObjects Class
产生此错误的行位于 SrcContainer = pTitleSheet.OLEObjects(1)
,其中pTitleSheet是具有以下代码的Microsoft excel对象:
The line that generates this error is at SrcContainer = pTitleSheet.OLEObjects(1)
where pTitleSheet is a microsoft excel object with the following code:
Option Explicit
Private Sub MasterTitleBox_BeforeContextMenu(ByVal x As Long, ByVal y As Long, ByVal Menu As OWC11.ByRef, ByVal Cancel As OWC11.ByRef)
'MsgBox CStr(x) + " " + CStr(y)
Cancel = True
End Sub
我不知道如何调试错误或找出为什么无法在Office 2003中运行该代码的情况下找到OLEObject.
I don't know how to debug the error or find out why it cant find an OLEObject as the code ran in Office 2003.
我还有一个问题,我看不到上面已发布代码的对象,这意味着我没有选择查看对象"的功能,请参见屏幕截图:
I furthermore have the problem, that I can't see the object that I have posted code for above, meaning that I have no option to "view object" see screenshot:
推荐答案
工作表中似乎没有OLEObject.尝试在此
It looks like there are no OLEObjects on the sheet. Try looking at pTitleSheet.OLEObjects.count
before this
line SrcContainer = pTitleSheet.OLEObjects(1)
它们可能已从ActiveX控件更改为工作表上的窗体控件.
They could have been changed from ActiveX controls to form controls on the sheet.