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
| Private Sub Mise_en_page_export(tx_fichier As String)
Dim xlApp As Excel.Application
Dim xlSheet As Excel.Worksheet
Dim xlSheet2 As Excel.Worksheet
Dim xlBook As Excel.Workbook
Dim xlBook2 As Excel.Workbook
Dim temp As String
' Initialisation des variables
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("P:\Commun\Tables temporaires\Stock_libre\Stocks_libres_FORMULES_CALCUL.xls")
temp = Mid(tx_fichier, 42)
Sheets(1).Select
xlApp.DisplayAlerts = False
xlApp.Sheets("Réalisé").Select
Range("D1516:AQ1537").Select
Selection.Copy
Set xlBook2 = xlApp.Workbooks.Open(tx_fichier)
Set xlSheet2 = xlBook2.Sheets(temp)
xlSheet2.Select
ActiveSheet.Paste Destination:=Worksheets(temp).Range("D1516")
xlBook.Save
xlBook2.Save
xlApp.Quit
Set xlSheet = Nothing
Set xlSheet2 = Nothing
Set xlBook = Nothing
Set xlBook2 = Nothing
Set xlApp = Nothing
End Sub |
Partager