Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Formatting Excel charts created with VBA

Hi,

I finally managed to figure out how to pass data from a VBA in word,
start a copy of Excel, pass the data to an Excel Range, create a Pie
Chart, then copy and paste this back into Word.

However, I have a couple of niggly little points that I can't seem to
figure out.

Firstly, I need to set the ChartTitle to the left hand side of the
chart, because if there a lot of entries, the DataLabels obscures the
title.

I've tried various things such as:

myChart.ChartTitle.Left = 0


....But it always remains centered, no matter what I seem to do.

Secondly, if there lots of entries, while the chart is created
correctly, the DataLabels can spill below the bottom of the chart.

I know I could ammend this by resizing the chart (but this is a bit
more complicated, as the chart data comes from a Word VBA userform),
but there seems to be huge gaps between the DataLabel entries, and I'm
sure I could get about ten entries on the chart quite easily if I was
able to remove these massive gaps (If I create a similar chart directly
in Excel, this in in proportion and everything fits well).

I'm currently going round in circles looking at the docs, so if anyone
has any useful pointers, please let me know....


Thanks
Neil.


The code I use to create the chart, if it is of any use is below:


Set oChart = oSheet.ChartObjects.Add(left:=30, Width:=350, Top:=75,
Height:=225).Chart


oChart.SetSourceData Source:=oSheet.Range("A1").Resize(cNumRows,
cNumCols), PlotBy:= _
xlColumns
oChart.ChartType = xl3DPieExploded
oChart.RightAngleAxes = True
oChart.PlotArea.Height = 215
oChart.PlotArea.Width = 215
oChart.PlotArea.left = 5
oChart.PlotArea.Fill.Visible = False
oChart.PlotArea.Fill.Visible = False
oChart.PlotArea.Border.LineStyle = -4142
oChart.Elevation = 30
oChart.Rotation = 80
oChart.Pie3DGroup.VaryByCategories = True
oChart.HasTitle = True
oChart.ChartTitle.Characters.Text = "Current Asset
Allocation"
oChart.ApplyDataLabels Type:=xlDataLabelsShowPercent,
LegendKey:=False _
, HasLeaderLines:=False
oChart.SeriesCollection(1).DataLabels.Font.Size = 8
oChart.Legend.Shadow = True

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charts created 2003 Appear black when received in excel 2007 MWH Blackheath Charts and Charting in Excel 0 March 24th 10 09:25 AM
Excel charts created don't show when e-mailed mainewayne Charts and Charting in Excel 6 July 29th 09 04:34 PM
Created Charts not appearing in Excel Tilly Charts and Charting in Excel 1 September 17th 08 04:15 AM
Charts created in Excel 2003 are not showing up in excel 2007 RLang07 Charts and Charting in Excel 1 May 25th 07 10:58 PM
Display Charts Created In Excel In A Windows Form Arvindtn Charts and Charting in Excel 0 September 15th 06 03:19 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"