Bonjour,
Comment puis-je déplacer le code de "feuille(s)" vers ThisWorkbook, sachant que le code en question est exécuté à partir de deux boutons sur chaque feuille ?
Merci d'avance pour votre aide,
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 Option Explicit Private Sub Fermer_Click() Application.EnableCancelKey = xlDisabled If MsgBox("Voulez-vous sauvegarder les modifications ?", vbYesNo) = vbNo Then Call AnnulePleinEcran ThisWorkbook.Close savechanges:=False Exit Sub End If With ActiveWorkbook ChDrive "C" ChDir .Path .SaveCopyAs Format(Now, "yyyymmdd-hh""h""nn") & " " & .Name End With Call AnnulePleinEcran ThisWorkbook.Close True Exit Sub End Sub Private Sub Imprime_Click() printclick = True 'cf. procédure dans ThisWorkbook pour forcer l'impression à partir du bouton de la feuille ActiveSheet.PageSetup.PrintArea = "A1:N25" With ActiveSheet.PageSetup .CenterHorizontally = True .CenterVertically = True .Orientation = xlLandscape .FitToPagesWide = 1 .FitToPagesTall = 1 .Zoom = 140 End With ActiveWindow.SelectedSheets.PrintPreview printclick = False ActiveSheet.Protect End Sub
Partager