Hello
I use a macro to generate my BOM and my macro no longer launches.
I have a bug at the beginning.
Excell opens but I mess with the statement "Set swModelDocExt = swModel.Extension"
I don't understand because it worked very well until then...
Could you help me identify the problem please?
thank you in advance
LSE
Option Explicit
Sub main()
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
Dim wbk As Excel.Workbook
Dim sht As Excel.Worksheet
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swBOMAnnotation As SldWorks.BomTableAnnotation
Dim swBOMFeature As SldWorks.BomFeature
Dim boolstatus As Boolean
Dim BomType As Long
Dim Configuration As String
Dim TemplateName As String
Dim TableTemplate As String
Dim sFileName As String
Dim Dossier_Nomenclature As String
Dim Repertoire As String
Sun Repertoire_Test As Boolean
Dim Fichier_ouvrir As Thong
Dim fichier_complet As Thong
Dim myError As Integer
Dim myWarning As Integer
Dim Nom_Fichier_Excell As Variant
Dim Path As String
Dim Fichier_section_source As String
Opening an Excell sheet
With xlApp
. Visible = True
Set wbk = . Workbooks.Add
Set sht = wbk. ActiveSheet
End With
' Retrieving Assembly Information
Set swApp = GetObject(, "SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
sFileName = swModel.GetPathName '= display name of the assembly with the path
Debug.Print sFileName
2022-04-08_15h58_44.png