Bonjour,
Voici ci dessous le modèle de ma macro qui fonctionne pour générer des fichiers en automatique.
Par contre les fichiers ne sont pas mis en forme, je souhaiterais qu'ils soient paramétrés en impression: 1 page en largeur, 2 en hauteurs
j'ai trouvé cette macro:
.FitToPagesWide = 1
.FitToPagesTall = 2
mais à quel niveau dois-je l'intégrer à ma macro existante pour que cela fonctionne..Encore merci pour votre aide! Bonne journée
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 Sub a() Dim i As Long, nwbk As Workbook, chemin$ chemin = "c:\temp\" Application.ScreenUpdating = False With ThisWorkbook.ActiveSheet derco = Cells(1, Columns.Count).End(xlToLeft).Column For i = 2 To derco If .Cells(1, i) <> "" Then Set nwbk = Workbooks.Add(-4167) .Range("A:C").Copy nwbk.Sheets(1).[A1:C1] .Cells(1, i).Resize(.Cells(.Rows.Count, i).End(xlUp).Row).Copy nwbk.Sheets(1).[D1] nwbk.Sheets(1).Cells.EntireColumn.AutoFit nwbk.SaveAs chemin & .Cells(1, i) nwbk.Close True End If Set nwbk = Nothing Next i End With End Sub
Partager