Salut mes amis,
j'ai cherché dans le forum des sujet concernant le lancement d'une macro automatique lors de l'ouverture de fichier Excel. J'ai pas atteint au résultat, voici le macro que j'ai trouvé :
mais mon cas est le suivant, je veux que lorsque j'ouvre le fichier excel, ce dernier lance cette macro :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 private sub workbook_open() msgBox "Salut "& environ("Username") & "Lancement de la mise à jour ? " Application.run ("'Miseajour'") end sub
Mes amis est ce que c'est possible lors d'ouverture du fichier excel, ce dernier lance automatique la macro précédente qui permet de créer une page de garde dans une feuille qui s'appelle "feuil10" (par exemple) et merci.
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 Sub Acceuil() Dim MaPlage As Range, Police As Font, Commentaire As Comment Dim MaFeuille As Worksheet Set MaFeuille = ThisWorkbook.Worksheets("Feuil10") With MaFeuille .Cells.ClearContents .Cells.ClearFormats .Cells.Interior.Color = 13434879 End With With MaFeuille.Range("E13:M26") With .Borders(xlEdgeLeft) .LineStyle = xlDouble .Weight = xlThick .ColorIndex = vbBlack End With With .Borders(xlEdgeTop) .LineStyle = xlDouble .Weight = xlThick .ColorIndex = vbBlack End With With .Borders(xlEdgeBottom) .LineStyle = xlDouble .Weight = xlThick .ColorIndex = vbBlack End With With .Borders(xlEdgeRight) .LineStyle = xlDouble .Weight = xlThick .ColorIndex = vbBlack End With End With Range("E13:M15").Select Selection.Interior.ColorIndex = 44 Range("E13:M15").MergeCells = True Range("E16:M17").Select Selection.Interior.ColorIndex = 36 Range("E22:M23").Select Selection.Interior.ColorIndex = 36 Range("E18:M19").Select Selection.Interior.ColorIndex = 36 Range("E18:M19").MergeCells = True Range("E20:M21").Select Selection.Interior.ColorIndex = 36 Range("E20:M21").MergeCells = True Range("E24:M26").Select Selection.Interior.ColorIndex = 44 Range("E24:M26").MergeCells = True Set MaPlage = ThisWorkbook.Worksheets("Feuil10").Range("E18:M19") Range("E18").Font.Name = "Book Antiqua" Worksheets("Feuil10").Range("E18").Value = "Application d'ordonnancement et de " Range("E18").Font.Size = 22 'Taille du texte Range("E18").HorizontalAlignment = -4108 Range("E18").VerticalAlignment = -4108 Range("E18").Font.Bold = True 'Ecriture gras Range("E20").Font.Name = "Book Antiqua" Worksheets("Feuil10").Range("E20").Value = " planification de la production " Range("E20").Font.Size = 22 'Taille du texte Range("E20").HorizontalAlignment = -4108 Range("E20").VerticalAlignment = -4108 Range("E20").Font.Bold = True 'Ecriture gras End Sub








Répondre avec citation
Partager