Is there a way to extract AutoCAD Drawings and Pictures from an OLEObject field in a table?

天大地大妈咪最大 提交于 2019-12-12 18:29:40

问题


Just for some background, I'm a mechanical engineer at a company and the older folks here created a database in Access 2003 which basically takes an AutoCAD Drawing or a Picture OLE and plops it in a nicely framed report with a bunch of other information. I've been making some modifications to that database, one of which is to store all OLEObjects as links to actual files in our shared network. Every new file that has been added to the database for the past week or so has been linked and the guys seem to have gotten the hang of it.

My problem at this point in time is to try and retrieve all the Objects that are embedded in the tables. I've tried Lebans OLE to Disk but that doesn't seem to work with AutoCAD Drawings (which are .dwg and .dxf files) nor does it work with "Picture".

I know this is a quite controversial topic seeing as how I'm not providing any code to start with, but I think this is too complicated for me to even begin doing and I'm in over my head. Extracting the OLEObjects by hand isn't feasible since there's over 8000 of these spread through several databases. Is there any way to automate the extraction via code?

Thanks in advance,

Rafael.


回答1:


If you access the Object property of the Bound Object Frame control, for an AutoCAD Drawing this should return the AutoCAD Document Object. You can then invoke the SaveAs method of the Document object to save the file to a known location.

For example, something like:

With Me.MyBoundObjectFrame.Object
    .SaveAs "Drive:\YourPath\YourDrawing.dwg"
End With

Where MyBoundObjectFrame is the name of your Bound Object Frame control.

This works successfully in my limited testing.



来源:https://stackoverflow.com/questions/56705196/is-there-a-way-to-extract-autocad-drawings-and-pictures-from-an-oleobject-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!