I'm having some trouple getting parts to save as an edrawing format. I've stepped through the program, everything is set to the expected values for all statements, but for some reason the SaveAs function returns false, no errors or warnings, and does not create anything in the target directory. If I use the supposedly obsolete SaveAs3 method (this is how it shows up when recording a macro), it even pops up the edrawings export configuration selection, but does not create a file.
Public Function ExportNamedEdraw(swCompModel, ExportPath, sDocNameNoExtension) As Boolean
Dim nErrors As Long
Dim nWarnings As LongNewFilePath = ExportPath & sDocNameNoExtension
If swCompModel.GetType = swDocPART Then
NewFilePath = NewFilePath & ".EPRT"
ElseIf swCompModel.GetType = swDocASSEMBLY Then
NewFilePath = NewFilePath & ".EASM"
End If
Set swApp = Application.SldWorks
bThrowaway = swApp.SetUserPreferenceIntegerValue(swEdrawingsSaveAsSelectionOption, swEdrawingSaveAll)
ExportNamedEdraw = swCompModel.Extension.SaveAs(NewFilePath, swSaveAsCurrentVersion, swSaveAsOptions_Silent, Nothing, nErrors, nWarnings)
End Function
Anyone have any ideas as to how to resolve this?
SolidworksApi macros