paulbentley
10-06-2015, 10:09 AM
Morning all,
I've recorded a simple macro that I hope to use to format all charts into a certain style in terms of font style and font size. For the purpose of some context, this code is also added into another piece of code that creates the chart from a data-set but I don't think that is important to know. The problem is when I run this code I get an error message and the formatting does not take place.
The error message is:
Runtime Error - 2147483645 (800000003) The specified value is out of range.
The code is: -
Sub EditFonts()'
' EditFonts Macro
'
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveSheet.Shapes("Chart 8").TextFrame2.TextRange.Font.Name = _
"Helvetica Neue Light"
ActiveSheet.Shapes("Chart 8").TextFrame2.TextRange.Font.Size = 9
End Sub
I appreciate this code references chart 8 which just happened to be the chart number that was generated as i've been testing the code.
If anybody can point out why this would not work i'd be very grateful. The code was generated with a recording and i've done nothing to edit it myself.
Thanks in advance.
Paul
I've recorded a simple macro that I hope to use to format all charts into a certain style in terms of font style and font size. For the purpose of some context, this code is also added into another piece of code that creates the chart from a data-set but I don't think that is important to know. The problem is when I run this code I get an error message and the formatting does not take place.
The error message is:
Runtime Error - 2147483645 (800000003) The specified value is out of range.
The code is: -
Sub EditFonts()'
' EditFonts Macro
'
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveSheet.Shapes("Chart 8").TextFrame2.TextRange.Font.Name = _
"Helvetica Neue Light"
ActiveSheet.Shapes("Chart 8").TextFrame2.TextRange.Font.Size = 9
End Sub
I appreciate this code references chart 8 which just happened to be the chart number that was generated as i've been testing the code.
If anybody can point out why this would not work i'd be very grateful. The code was generated with a recording and i've done nothing to edit it myself.
Thanks in advance.
Paul