标题: selectbyID2类型不匹配 [打印本页] 作者: xdhong 时间: 2010-12-1 16:15 标题: selectbyID2类型不匹配 我第一次用VS2008中的VB 对Solidworks2008进行二次开发,就画一个方块,录制宏代码,但调试总出现未处理的COMException,类型不匹配。异常来自 HRESULT:0x80020005 (DISP_E_TYPEMISMATCH))。
求助各位这是怎么回事,应该怎么改啊?
原代码如下:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim swapp As Object
Dim Part As Object
Dim SelMgr As Object
Dim Boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Dim strpth As String
swapp = CreateObject("SldWorks.Application") ' 建立联接
Part = swapp.newpart ' 新建零件
Part = swapp.ActiveDoc
SelMgr = Part.SelectionManager