Ratan Bhushan
Member
Hi team
I have prepared a two Custom-Ribbon buttons.
One to copy the formatting, height and width of chart.
and another to paste the same on other selected chart.
The problem is when I am using the PASTE button, it is not picking the height and width of the previous chart.
Please help in this.
I have attached the file.
I have prepared a two Custom-Ribbon buttons.
One to copy the formatting, height and width of chart.
and another to paste the same on other selected chart.
The problem is when I am using the PASTE button, it is not picking the height and width of the previous chart.
Please help in this.
I have attached the file.
Code:
Global shpae_height As Long
Global shpae_width As Long
Sub copy_format(control As IRibbonControl)
Dim cbject As ChartObject
If ActiveChart Is Nothing Then
MsgBox "Please select chart"
Else
shape_height = ActiveChart.Parent.Height
shape_width = ActiveChart.Parent.Width
ActiveChart.ChartArea.Copy
End If
End Sub
Sub paste_format(control As IRibbonControl)
If ActiveChart Is Nothing Then
MsgBox "Please select chart"
Else
ActiveChart.ChartArea.Select
ActiveSheet.PasteSpecial Format:=2
ActiveChart.Parent.Height = shape_height
ActiveChart.Parent.Width = shape_width
End If
End Sub