How do I open an Excell file using a macro from Solidworks?

Hello

I use a macro on Solidworks which has created an Excell file for me to enter the nomenclature.

While this file is still open, I would like to open another excell file present on my disk. To do this, I used the following instructions:

Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
Dim wbk As Excel.Workbook
Dim sht As Excel.Worksheet

Dim Fichier_section_source As String

Fichier_section_source = "\\vx-c-0004h\D$\MISCELLANEOUS\to be thrown away\Liste_profilé_concatener.xls"
    
Dim oXL As Excel.Application
Dim oWB As Workbook

'Start excel and get application
Set oXL = CreateObject("Excel.application")
oXL.Visible = True

Opening the binder
Set oWB = oXL.Workbooks.Open(Fichier_section_source)

 

I'm getting an error message on Excell saying that it is impossible to open this file... and on Solidworks, I have a 1004 error (file name or access that does not exist / file used by another program).

Do you have an idea?

2nd question: Which Excell extensions can I open from SolidWorks? xlsx, xlsm?

 

thank you for your help

I took a step forward and managed to open the file using the following code:

Dim xlSheet As Object
Dim xlBooks As Object

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open Fichier_section_source
Set xlSheet = xlApp.ActiveSheet

Sheets("Hardware List"). Select    ' and there I have a runtime error 9  (this tab exists)
 

Do you have an idea? Thank you