Hello, I am having trouble figuring out how to create a macro that saves the current SOLIDWORKS Part file as an .STL file ONTO the Desktop. This was not my code. I found it online and tried to reverse engineer it to save it to desktop instead of the part file's folder, but am calling it quits and am seeking help.
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As LongSub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
If Part Is Nothing Then Exit Sub
Dim Path As String
Path = Part.GetPathName
If Part.GetType = swDocDRAWING Then
Exit Sub
End If
Dim Extension As String
Extension = Mid(Path, InStrRev(Path, "."))
Path = Replace(Path, Extension, ".stl")
Extension = ".stl"longstatus = Part.SaveAs3(Path, 0, 0)
MsgBox "Saved " & Path, vbInformation
End Sub
Anything would be appreciated, thank you.
SolidworksApi/macros