ExportFlatPatternView (flat patterns to dxf's)I

I am trying to write a Macro to automate the export of flat patterns from SW SLDPRT files containing a single Sheet-Metal part and associated Flat-Pattern.

I have gone through the forums and other online sources and my current macro is as follows:

Function ExportFlatPatternDXF(ByVal filePath As String) As Boolean

    Dim swApp As SldWorks.SldWorks

    Dim swModel As SldWorks.ModelDoc2

    Dim swModelDocExt As SldWorks.ModelDocExtension

    Dim boolstatus As Boolean

    Dim longstatus As Long, longwarnings As Long

    

    Set swApp = Application.SldWorks

   

    Set swModel = swApp.ActiveDoc

   

    Set swModelDocExt = swModel.Extension

   

    boolstatus = swModel.ExportFlatPatternView(filePath, 0)

   

End Function

I am not calling SaveAs in this function as it is performed later in the macro (this is only part of a larger automation workflow).

The function works fine and exports the DXF correctly. My only problem is that when ExportFlatPatternView is called, a SaveAs dialog pops up to force me to save the part before proceeding.

How can I avoid / suppress this SaveAs dialog?

SolidworksApi macros