Bonsoir j'ai un problème d'incompatibilité type sur cette macro je ne comprend pas d'ou elle viens
Merci d'avance pour votre aide
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 Sub Generer_Fichier_Texte_PRINT1a() Dim i As Long, j As Long, ar Dim sRepertoire As String, sNomFichier As String Dim iFile As Integer Dim str As String sRepertoire = "C:\Users\thoms\Desktop\TEST PROJET TEXT\ '// doit terminer avec un " \ "" sNomFichier = "OutputPrint1a.txt" '// nom du fichier On Error Resume Next Kill sRepertoire & sNomFichier '// effacer le fichier existant iFile = FreeFile Open sRepertoire & sNomFichier For Output As #iFile '// crée le fichier texte ar = Sheets(1).Cells(1).CurrentRegion.Value '// valeurs dans un array (plus rapide) For i = 1 To UBound(ar, 1) '// boucle sur les lignes str = "" For j = 1 To UBound(ar, 2) '// boucle sur les colonnes str = str & ar(i, j) & vbTab '// valeurs séparées par tabulations Next j Print #iFile, str '// écrire dans le fichier Next i Close #iFile '// Fermer le fichier On Error GoTo 0 End Sub
Partager