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 56 57 58 59 60 61
|
Private Sub cmd_export_Click()
'*******************************************************************
'***** exportation des sélectionner dans un fichier .xls **********
'*******************************************************************
Dim oAppExcel As Excel.Application
Dim oClasseur As Excel.Workbook
Dim oFeuille As Excel.Worksheet
Dim oCell As Excel.Range
Dim txtChemin As String
Dim nb_feuille As Integer
txtChemin = "C:\Documents and Settings\laborder\Bureau\table access\liste sélectionner.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "vic", txtChemin, -1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "baglan", txtChemin, -1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "uti", txtChemin, -1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "lourdes", txtChemin, -1
'Ouvre le fichier excel
Set oAppExcel = CreateObject("Excel.Application")
Set oClasseur = oAppExcel.Workbooks.Open(txtChemin)
'Sélectionne la premiere feuille
Set oFeuille = oClasseur.Worksheets(1)
Columns("A:A").ColumnWidth = 10
Columns("B:B").ColumnWidth = 19
Columns("C:C").ColumnWidth = 23
Columns("D:D").ColumnWidth = 20
Columns("E:E").ColumnWidth = 50
Columns("F:F").ColumnWidth = 10
Columns("G:G").ColumnWidth = 33
Columns("H:H").ColumnWidth = 33
Columns("I:I").ColumnWidth = 10
Columns("J:J").ColumnWidth = 24
Columns("K:K").ColumnWidth = 30
Columns("L:L").ColumnWidth = 44
Columns("M:M").ColumnWidth = 15
Columns("N:N").ColumnWidth = 30
Columns("O:O").ColumnWidth = 6
Columns("P:P").ColumnWidth = 30
Columns("Q:Q").ColumnWidth = 50
Columns("R:R").ColumnWidth = 12
Columns("S:S").ColumnWidth = 30
Columns("T:T").ColumnWidth = 9
Columns("U:U").ColumnWidth = 20
Columns("V:V").ColumnWidth = 23
Columns("W:W").ColumnWidth = 17
'Ferme Excel
oClasseur.Save
oClasseur.Close
oAppExcel.Quit
Set oAppExcel = Nothing
Set oClasseur = Nothing
Me.affichage1 = "liste a recupérer dans : " & txtChemin
End Sub |
Partager