If I look in SW's help, there is not much: http://help.solidworks.com/SearchEx.aspx?q=dialog+box+vba&sort=&version=2018&lang=English&prod=api&context=LANG%3den%26NRESULTS%3d25
As prossignol said, you need to use the SaveAs Method API (IModelDocExtension) to export your file. For the dialog box you can just make a msgBox with choice and process what to do according to the user's feedback. Here is an example of what you can do in your macro in the action for a room
ElseIf (swModel.GetType = swDocPART) Then
swModel.SetTitle2 "$PRP:SW-File Name"
Dim namePRT As String
Dim chemin As String
chemin = "D:\Etude\Commerce\"
namePRT = chemin & swModel.GetTitle & ".sldprt"
If MsgBox("Voulez-vous sauvegarder cette pièce ?", vbYesNo, "Enregistrement") = vbYes Then
swModel.SaveAs namePRT
End If
End If
Thank you for these answers, but I want to keep the window open with windows explorer because there is a tree structure in this "Commerce" folder to store the components.
Sorry, but at the moment, I don't see a better answer....
In this case, it is possible to open an "explorer" without using the SW dialog window. It's something more generic and allows you to navigate through the tree.
You can also use a BrowserForFolder to allow the user to choose the destination folder:
ElseIf (swModel.GetType = swDocPART) Then swModel.SetTitle2 "$PRP:SW-File Name"
Dim namePRT As String
Dim chemin As String
chemin = "D:\Etude\Commerce\"
If MsgBox("Voulez-vous sauvegarder cette pièce ?", vbYesNo, "Enregistrement") = vbYes Then
Dim objShell As Shell
Dim ssfWINDOWS As Long
Dim objFolder As Folder
Set objShell = New Shell
Set objFolder = objShell.BrowseForFolder(0, "SelectDossiers", 0, chemin)
If (Not objFolder Is Nothing) Then
namePRT = objFolder & "\" & swModel.GetTitle & ".sldprt"
swModel.SaveAs namePRT
End If
End If
End If
Be careful, you have to put "Microsoft Shell Controls And Automation" in the project references.