几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 02:01 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】runtime error 9

runtime error 9
a user recently downloaded a macro and could not run due to "runtime error 9". i have not been able to trace a cause. other users have downloaded and used same program w/ no issues.
any ideas?
tools->references... remove all sw references and re-add. always the first thing to try. if not give me a link to the macro and i will try it out
references were re-added in the new "2007" version.
roland,
not sure if i downloaded the correct file, but "deletecustominfo-2007.zip i get the same runtime error. in looking at the sub main() i see where you have a set swapp = createobject("sldworks.application"). since this is a macro, it should be set swapp = application.sldworks. this is what makes me thing this is the wrong file. this macro should not run on any machine.
wayne matus
texas engineering systems
it's running fine on six different machines here.
wayne: if you have the time, see what happens when you change that line.
edited: 05/16/2008 at 01:41 pm by roland schwarz
originally posted by: wayne matusthis macro should not run on any machine.
it runs fine on my machine.
drc inc.
minneapolis, mn
.designreadycontrols.com
sw2007 sp5.0
core2 quad
3gb ram
xp pro sp2
ati firegl v3600
roland,
it runs fine on my machine with the change. in debug mode without the change swapp is nothing, so it cannot connect to solidworks. it is puzzling why it works on some machines and not on others.
wayne matus
texas engineering systems
a million thanks, wayne.
sw used to use createobject to load the swapp object. i've had some macros that wouldn't work any other way.
still use createobject in vb6, vb.net or excel vba. only use application.sdlworks in solidworks macros.
wayne matus
texas engineering systems
you can use "application.sdlworks" in any program or macro that is running "in-process" with sw threads, such as macros.
the createobject method calls a marshall and searches the rot (running objects table) for the given string ("sldworks.application"), so if it is failing on that machine it means that your solidworks installation is no registering itself correctly for com access, so if i were you i would re-install sw, restart your machine, start sw up at least once and then try the macro again with the getobject function as it should work.
luke,
that explains why my getobject in a vb.net exe programs would not connect to an existing session of solidworks. exitapp would not kill the process either. i ended up having to use brute force to make the program to work. i searched the processes running. if solidworks was, i got the id of the sldworks.exe process and launched a new session of solidworks. at the end of the program i then killed the new sldworks.exe process and left the old one running if there was one.
wayne matus
texas engineering systems
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 01:04 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多