Microsoft Office Tutorials and References
In Depth Information
Discovering VBA Charting Tricks
Figure 18-17: This chart uses data from arrays (not stored in a worksheet).
The following procedure creates a picture of the active chart. (The original chart isn’t deleted.) It
works only with embedded charts.
Sub ConvertChartToPicture()
Dim Cht As Chart
If ActiveChart Is Nothing Then Exit Sub
If TypeName(ActiveSheet) = “Chart” Then Exit Sub
Set Cht = ActiveChart
Cht.CopyPicture Appearance:=xlPrinter, _
Size:=xlScreen, Format:=xlPicture
ActiveWindow.RangeSelection.Select
ActiveSheet.Paste
End Sub
When a chart is converted to a picture, you can create some interesting displays by using the
Picture Tools Format Picture Styles commands (see Figure 18-18 for an example).
The two examples in this section are available on the companion CD-ROM. The filename
is unlinked charts.xlsm .
Displaying text with the MouseOver event
A common charting question deals with modifying chart tips. A chart tip is the small message
that appears next to the mouse pointer when you move the mouse over an activated chart. The
chart tip displays the chart element name and (for series) the value of the data point. The Chart
object model does not expose these chart tips, so there is no way to modify them.
 
Search JabSto ::




Custom Search