setting font and other properties for datalabels

M

Markus

I am having problems with my code that automates Excel 03 when applied to
Excel 07. The problem is in charting.

I use the following code (used in many prior versions of Excel) to set the
datalabels in an Excel chart that was created successfully:

oExcel.ActiveChart.SeriesCollection(1).DataLabels.Select

This line works fine in 03, but is coughing up an error “Data Type Mismatch
Expecting Object†when run in Excel 07 (the chart itself does get constructed
successfully in 07). I checked and ActiveChart and SeriesCollection(1) are
defined objects, but Datalabels returns as empty and must be causing the
error since it cannot be selected.

I tried:
oExcel.ActiveSheet.ChartObjects("Chart 1").activate
oExcel.ActiveChart.SeriesCollection(1).DataLabels.Select

Which appears to be how a recorded macro would do it, but still the same
error message.

Anyone have a solution to this or even any ideas on what I might try.

Many thanks for any and all ideas,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top