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
| Dim xlApp As Excel.Application 'Application Excel
Dim xlwb As Excel.Workbook 'Classeur Excel
Dim xlws As Excel.Worksheet 'Feuille Excel
Dim xlws_new As Excel.Worksheet 'Nouvelle feuille Excel ajoutée
'Ouverture de l'application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
'Ouverture d'un fichier Excel
Set xlwb = xlApp.Workbooks.Open(cheminRepExport & "\" & site & "_Artcls_Export_" &
Date & ".xls")
' xlws correspond à la feuille "articles_export" du classeur
Set xlws = xlwb.Worksheets("articles_export")
xlws.Cells.Select
xlws.Cells.Copy
' xlws_new correspond à la nouvelle feuille "artcls_export" ajoutée au classeur
Set xlws_new = xlwb.Worksheets.Add
xlws_new.Name = "artcls_export"
xlws_new.Range("A1").Select
xlws_new.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False ' ne fonctionne pas sous Access !!!
xlws.Delete
xlwb.Save
xlwb.Close 'Fermeture du classeur Excel
xlApp.Quit 'Fermeture de l'application Excel
'Désallocation mémoire
Set xlws = Nothing
Set xlws_new = Nothing
Set xlwb = Nothing
Set xlApp = Nothing |
Partager