PC Review


Reply
Thread Tools Rate Thread

Displaying Excel Chart Legends and their VALUES/DATA using Access VBA

 
 
New Member
Join Date: Aug 2008
Location: Nagasaki, Japan
Posts: 2
 
      26th Aug 2008
Hello,


I have a simple code here that creates a Chart in Excel using Access VBA:

Code:
	'Start Excel and create a new workbook
	Set oXL = CreateObject("Excel.application")
	Set oBook = oXL.Workbooks.Add
	Set oSheet = oBook.Worksheets.Item(1)
	
	' Insert Random data into Cells for the two Series:
	Randomize Now()
	For iRow = 1 To cNumRows
	   For iCol = 1 To cNumCols
		  aTemp(iRow, iCol) = Int(Rnd * 50) + 1
	   Next iCol
	Next iRow
	oSheet.Range("A1").Resize(cNumRows, cNumCols).Value = aTemp
	
	'Add a chart object to the first worksheet
	Set oChart = oSheet.ChartObjects.Add(50, 40, 300, 200).Chart
	oChart.SetSourceData Source:=oSheet.Range("A1").Resize(cNumRows, cNumCols)

	oChart.ChartType = 51 'xlColumnClustered

	oChart.HasTitle = True
	oChart.ChartTitle.Text = "Chart Title Here"

	' Make Excel Visible:
	oXL.Visible = True
	oXL.UserControl = True
I got this from http://support.microsoft.com/kb/142387#appliesto site.

What I wanna know is how to put the legend at the bottom with values per x-axis column?

I think others call it data table or series collection.

I want to see not only the graph but also the equivalent data based by the graph. I was thinking data can be placed along with the legend at the bottom in-line with the x-axis.

Can anyone help me on this?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Public Function - Excel to PPT Stacked Chart, How to Remove Legends JUNKYARDWILLIE Microsoft Excel Programming 0 27th Sep 2010 10:24 PM
How can I post values in excel chart without displaying the colum. Noa Microsoft Excel Charting 5 18th Jan 2008 02:17 PM
Column chart not displaying some data points - Excel 2003 =?Utf-8?B?RG9uIEJ1cmdlc3M=?= Microsoft Excel Charting 3 28th Nov 2006 06:20 PM
Excel Chart Legends need alignment option (rotate 90-180-270 deg) =?Utf-8?B?cm9uIGViZWxoYXI=?= Microsoft Excel Charting 2 29th Aug 2005 06:13 PM
Legends in a pie chart in excel 2000 DevArrah Microsoft Excel Programming 0 24th Aug 2004 04:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:23 AM.