编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

无法获取oleobject类的对象属性:unable to get object property of oleobject class

statiksof 面向对象 2022-5-11 10:44 7人围观

腾讯云服务器
无法获取oleobject类的对象属性的处理方法

我正在尝试将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.

查看全文

腾讯云服务器 阿里云服务器
关注微信
^