Re : Vérouiller un graphique interactif
Bonjour kjin,
Merci de la réponse. Il semble que cela ne marche pas dans excel 2007:
"Using VBA to deactivate a chart
You can use the Activate method to activate a chart, but how do you deactivate (that is, unselect) a chart? According to the Help System, you can use the Deselect method to deactivate a chart:
ActiveChart.Deselect
However, this statement simply doesn't work - at least in the initial release of Excel 2007.
As far as I can tell, the only way to deactivate a chart by using VBA is to select something other than the chart. For an embedded chart, you can use the RangeSelection property of the ActiveWindow object to deactivate the chart and select the range that was selected before the chart was activated:
ActiveWindow.RangeSelection.Select
"
Excel 2007, Power Programming with VBA, John Walkenbach
Ce n'est pas si grave vu que la feuille est protégée. L'autre solution est de faire ça:
Private Sub Chart_Select(ByVal ElementID As Long, _
ByVal Arg1 As Long, ByVal Arg2 As Long)
ActiveChart.ChartArea.Select
End Sub
Mais le risque est que l'usager déplace la zone de graphique, du coup la simple protection est probablement la meilleure solution.
merci,
gravier