SolidWorks机械工程师网——最大的SolidWorks学习平台

标题: 求助 Solidworks VBA 二次开发问题 [打印本页]

作者: nothing__here__    时间: 2010-1-10 00:55
标题: 求助 Solidworks VBA 二次开发问题
提示错误:变量对象或WITH块变量未设置
代码如下:
Private Sub CommandButton1_Click()
Dim path As String
path = ThisWorkbook.Worksheets("Sheet1").Range("B6").Value
If path = "" Then

MsgBox ("请输入文件路径!")

Else

Dim SwApp As SldWorks.SldWorks
Dim PartDoc As SldWorks.PartDoc
Dim modelDoc As SldWorks.ModelDoc2
Dim Myfeature As SldWorks.feature

Set SwApp = CreateObject("SldWorks.Application")

Set PartDoc = SwApp.OpenDoc(path, swDocPART)
Set Myfeature = PartDoc.FeatureByName("草图1")

MsgBox (Myfeature.Parameter("upR1").Value)

SwApp.Quit (path)

Set SwApp = Nothing
End If
End Sub
作者: Archar    时间: 2010-1-12 15:15
高端啊




欢迎光临 SolidWorks机械工程师网——最大的SolidWorks学习平台 (https://www.swbbsc.com/) Powered by Discuz! X3.2