几何尺寸与公差论坛

 找回密码
 注册
查看: 804|回复: 0

【转帖】import part custom property into msword

[复制链接]
发表于 2009-4-13 12:10:25 | 显示全部楼层 |阅读模式
import part custom property into msword
is there a simple way to import a sw custom property into msword? for example, import a part's "description" property value into a word document. non-programmer here. tia.
marc
here is the vba code.
sub macro1()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
set swapp = createobject("sldworks.application")
set swmodel = swapp.activedoc
selection.typetext text:=(swmodel.getcustominfovalue("", "description"))
set swmodel = nothing
set swapp = nothing
end sub
i have attached a word .doc for you. you must set the reference to the solidworks 200x (replace the x with your version) type library in the vba editor. i am not sure if this will carry over in the document i put together. once the vba editor is open, tools>references. check the corresponding box. you can then save the macro. from the visual basic toolbar, hit the play button and choose macro1. this will import your "description" custom property to your current cursor position.
make sure that you have a part, assembly, or drawing open before you run this.
tony szuta
cswa, cswp, cswp-smtl
intel core2 quad (q6600 @ 2.40 ghz)
nvidia quadro fx 4600 sdi
solidworks 2008 sp 4.0 (x32 & x64)
solidworks 2009 sp 2.0 (x32 & x64)
edited: 09/05/2008 at 05:21 pm by tony szuta
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 14:22 , Processed in 0.034667 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表