Files
Lesson 3.1 code
Code
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDocSpec As SldWorks.DocumentSpecification
Dim lngErrors As Long
Dim lngWarnings As Long
Const strFullPath As String = "C:\Users\Keith\Desktop\Macros\vblock.SLDPRT"
Sub main()
Set swApp = Application.SldWorks
Set swDocSpec = swApp.GetOpenDocSpec(strFullPath)
Set swModel = swApp.OpenDoc7(swDocSpec)
swModel.ShowNamedView2 "", 7
swModel.ViewZoomtofit2
Dim strNewPath As String
strNewPath = Replace(swModel.GetPathName, ".SLDPRT", ".eprt")
swModel.Extension.SaveAs strNewPath, 0, 1 + 2, Nothing, lngErrors, lngWarnings
Debug.Print lngErrors
Debug.Print lngWarnings
swApp.CloseDoc swModel.GetTitle
End Sub