weixin_45141737
流云沐青
2020-10-28 20:43

vbs文件打开时出现错误代码800A01A8该怎么解决?

图片说明

就是 在Part.Parameter("HeightUp@草图1").System Value = Val1这行代码上

Dim swApp

Dim Part

On Error Resume Next

Set swapp = GetObject(,"SldWorks. Application")

If Err Then 
 Err. Clear 
 Set swApp = CreateObject("SldWorks. Application")
 Set Part = swApp. ActiveDoc
 swApp.Visible = true 
 swApp.UserControl = True 

End If

        Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile("beam.SLDPRT")               
  Set Part = swApp. OpenDoc(objFSO. GetAbsolutePathName(objFile), 1)                    
  Set Part = swApp.ActivateDoc("beam.SLDPRT")
  'swApp.Visible = true 

On Error GoTo 0 


Call ChangePara(Part,0.05,0.02,0.02,0.02,0.05,0.02,0.2)

Sub ChangePara(Part,Val1,Val2,Val3,Val4,Val5,Val6,Val7)

Part.Parameter("HeightUp@草图1").System Value = Val1

Part.Parameter("Height Down@草图1").System Value = Val2

Part.Parameter("FlangeRight@草图1").System Value = Val3

Part.Parameter("FlangeLeft@草图1").System Value = Val4

Part.Parameter("Height@草图1").System Value = Val5

Part.Parameter("Width@草图1").System Value= Vale6 

Part.Parameter("Length@拉伸1").System Value = Val7


Part.EditRebuild 


End Sub 


Part.SaveAs(objFSO.GetParentFolderName(objFile)&"\"&"beam.igs")

swApp.CloseDoc"beam.SLDPRT"

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

相关推荐