Hello
Being a beginner and a tinkerer☺, I am looking for a code or macro to save a table in excel format on a solidworks drawing.
Clearly, in a drawing, I have 2 tables ''ERP Table'' & ''Nomenclature ERP'' (see screenshot in attachments) that I want to save in excel format (xls or xlsx) in a specific directory.
I cobbled together a piece of code using one of my existing macros, I can create my path and filename and select the tables but I don't know how to do the .xls saving for each selection.
It must be very simple but I don't think so.
Thank you in advance for your help
Thierry
Excerpt from the current Code:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
Dim myVar As Variant, RetVal As Integer, Reponse2 As String
boolstatus = Part.ActivateSheet("Feuille2")
myRev = Part.GetCustomInfoValue("", "Révision")
Const swCommands_Save As Long = 2
'DOSSIER ATTENTE & NOM de FICHIER EXCEL
myVar = Split(Part.GetPathName, "\", -1)
'Chemin et nom de fichier XLS pour table ERP
myNew_table_ERP = "C:\0-Plan en Attente" & "\" & Mid(myVar(UBound(myVar)), 1, Len(myVar(UBound(myVar))) - 7) & "-" & myRev & ".xlsx"
'Sélection ''table ERP''
boolstatus = Part.Extension.SelectByID2("Table ERP", "GENERALTABLEFEAT", 0, 0, 0, False, 0, Nothing, 0)
'enregistrer en xls ''table ERP''
?????????????????
'Chemin et nom de fichier XLS pour Nomenclature ERP
myNew_Nomenclature ERP = "C:\0-Plan en Attente" & "\" & Mid(myVar(UBound(myVar)), 1, Len(myVar(UBound(myVar))) - 7) & "-" & Nomen & ".xlsx
'Sélection ''Nomenclature ERP''
boolstatus = Part.Extension.SelectByID2("Nomenclature ERP", "BOMFEATURE", 0, 0, 0, False, 0, Nothing, 0)
'enregistrer en xls ''Nomenclature ERP''
?????????????????
End Sub
feature.jpg