Bonjour,
Aidez-moi svp, je veux exporter le contenu d'1 MsFlexGrid vers un fichier Excel.
Merci
Version imprimable
Bonjour,
Aidez-moi svp, je veux exporter le contenu d'1 MsFlexGrid vers un fichier Excel.
Merci
Salut,
A adapter et optimiser selon tes besoins :)Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Private Sub Command1_Click() Dim DExcel As Object Set DExcel = CreateObject("Excel.Application") colHeader = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y") DExcel.DisplayAlerts = False DExcel.Workbooks.Add DExcel.Sheets("Feuil1").Select DExcel.Sheets("Feuil1").Name = "Mes données Transférées" With MSFlexGrid1 For intRow = 0 To .Rows - 1 For intCol = 0 To .Cols - 1 DExcel.Range(colHeader(intCol) & (intRow + 1)).BorderAround Color:=vbBlack DExcel.Range(colHeader(intCol) & (intRow + 1)) = .TextMatrix(intRow, intCol) Next intCol Next intRow End With DExcel.ActiveWorkbook.Close True, "C:\MonFichier.xls" DExcel.Quit End Sub
ça marche bien
seulement ça prend bouceaup de temps (l'operation est trop lente)!
Merci