Bonjour voila j ai petit problème sur mon code je voudrais ouvrir plusieurs excel dans un même dossier en même temps en lecture seul pour les copier en .txt

mon problème viens de cette ligne : if objFile.Extension = "xlsx" thenvoici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'*****************************************************
Const ForReading = 1, ForWriting = 2, ForAppending = 8
'*****************************************************
Dim objExcel
 
'objet application excel
Set objExcel = CreateObject("Excel.Application")
  strComputer = "."
 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 set colFileList = objWMIService.ExecQuery _
     ("ASSOCIATORS OF {Win32_Directory.Name = 'C:\MTOM\Traitement'}  Où ResultClass = CIM_DataFile")
 
 set objExcel = CreateObject ("Excel.Application")
 objExcel.Visible = TRUE
 
objExcel.Application.DisplayAlerts = True
 
if objFile.Extension = "xlsx" then
	objExcel.Application.Workbooks.Open objFile.Name, "3", True, , "max"
    ElseIf objFile.Extension = "doc" or objFile.Extension = "docx" Then
		objWord.Documents.Open objFile.Name
		'objet fichier
		Dim fso, fi, x, TextStreamTest
		Set fso = CreateObject("Scripting.FileSystemObject")
		'definition fichier
		dim nom_Fichier,chemin_Fichier,Separateur
		nom_Fichier = "Excel"
		chemin_Fichier="C:\MTOM\Temp\"
		Separateur=" "		
		'creation fichier
		Set fo = fso.OpenTextFile(chemin_Fichier & nom_Fichier & ".txt",ForWriting,True)
		'ligne de depart lecture fichier excel	
		intRow = 1 
		ColumnCount = objExcel.Activesheet.UsedRange.Columns.count
		'boucle de lecture lignes fichier excel
		Do Until objExcel.Cells(intRow, 1).Value = ""
			TextStreamTest = ""
			'boucle de lecture colonne de la ligne
			For x= 1 To  ColumnCount 		'max colonne a modifier 
				TextStreamTest = TextStreamTest & objExcel.Cells(intRow, x).Value & Separateur
			Next
			'affiche ligne dans boite a message
			'Wscript.Echo "text: " & TextStreamTest
			'ecriture fichier TXT
			fo.writeline(TextStreamTest)
			'incremente pointeur de ligne
			intRow = intRow + 1
		Loop
		'fermeture fichier
		fo.Close
		'fermeture excel via objet application
		objExcel.Quit
		'termine
		Wscript.Echo "Conversion terminée"
 end if