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

Joined
Aug 26, 2008
Messages
2
Reaction score
0
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?
confused.gif


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?
confused.gif
 

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