Bonjour

J'utilise une page graphique pour dessiner. J'ai réalisé plusieurs macros pour définir les paramètres par défaut (couleur, style, épaisseur ...)

Cette macro fonctionne très bien sur une feuille Excel par contre sur une page graphique, il n'est pas possible de définir ces paramètres.

Existe-t-il une solution plus simple pour définir ces paramètres?

Merci de votre aide

Regor


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
Private Sub CommandButton12_Click()
ActiveSheet.Shapes.AddLine(234.75, 107.25, 403.5, 107.25).Select
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.Line.ForeColor.SchemeColor = 12
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.Weight = 2.5
    Selection.ShapeRange.Line.Style = msoLineSingle
 ' Selection.ShapeRange.Line.DashStyle = msoLineDash 'Trait en pointillé
    Selection.ShapeRange.Line.DashStyle = msoLineSolid 'Trait plein
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.SetShapesDefaultProperties
 '   Selection.Delete
    Selection.ShapeRange.Line.Visible = msoFalse
 
Dim cmd_bar As CommandBar, cmd_control As CommandBarButton
 
Set cmd_bar = Application.CommandBars("Lines")
 
For Each cmd_control In cmd_bar.Controls
    If cmd_control.ID = 200 Then
cmd_control.Execute
Exit For
 
End If
 
Next
End Sub