没有OLE应用程序的Microsoft Office中提取OLE对象数据 [英] Extract OLE object data in Microsoft Office without OLE application

查看:324
本文介绍了没有OLE应用程序的Microsoft Office中提取OLE对象数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用VBA/VSTO在Microsoft Office中提取嵌入式OLE对象的内容?我说的是一种情况,其中用于创建OLE对象的应用程序不可用.在这种情况下,某种转换器应用程序可以利用原始数据.

Is it possible to extract the content of an embedded OLE object in Microsoft Office using VBA/VSTO? I am talking about a situation where the application with which the OLE object was created is not available. In this case some sort of converter application could make use of the raw data.

例如,在Excel中,可以通过ActiveSheet.Shapes(x).OLEFormat访问该对象,但是我还没有找到一种方法来检索该对象的原始数据.

For instance, in Excel the object is accessible via ActiveSheet.Shapes(x).OLEFormat but I have not found a way to retrieve the raw data of the object.

一种方法是打开本机文件(Office Open XML/复合文件)并从中提取数据.但是也许有一种更简单的方法?

One way would be to open the native file (Office Open XML/Compound File) and extract the data from there. But maybe there is a simpler approach?

推荐答案

OLEObject复制到剪贴板,然后从剪贴板获取它,例如在VSTO中是这样的:

Copy the OLEObject to the clipboard then get it from the clipboard, e.g. something like this in VSTO:

Dim ole as OLEObject
...
ole.Copy
...
Clipboard.GetData("Embedded Object")

在VBA中,我刚刚通过Shell打开一个文件夹,然后使用SendKeys粘贴.

In VBA I have just been opening a folder through Shell then pasting using SendKeys.

ole.copy
Shell "explorer.exe " & sFolderName, vbNormalFocus
Application.Wait Now() + TimeSerial(0, 0, 3)
Application.Sendkeys "^v"

这篇关于没有OLE应用程序的Microsoft Office中提取OLE对象数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆