473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

VB.NET 2005 Excel Chart Object Syntax

I am trying to automate an excel spreadsheet and then create a chart.

Dim chartRange As Excel.Range
If rollup Then
chartRange = sheet.Range("O2:Q14", Type.Missing)
chartRange.Select()
Else
chartRange = sheet.Range("N:N,M:M,A:A", Type.Missing)
chartRange.Select()
End If
excelBook.Charts.Add()
Dim chart As Excel.Chart = excelBook.ActiveChart
excelApp.ScreenUpdating = False
With chart
.Name = "TPE Graph"
.ChartType = Excel.XlChartType.xlColumnStacked100
.HasTitle = True
.PlotArea.Interior.ColorIndex = 0
.ChartTitle.Text = chartTitle

Dim xlAxisCategory, xlAxisValue As Excel.Axes
xlAxisCategory = chart.Axes(Type.Missing, Excel.XlAxisGroup.xlPrimary)
******* HERE IS ISSUE *****
xlAxisCategory = (.Axes(, Excel.XlAxisGroup.xlPrimary))
xlAxisCategory.Item(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary).HasTitle = True
xlAxisCategory.Item(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary).AxisTitle.Font.Bold = True
xlAxisCategory.Item(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary).AxisTitle.Text = "Week"
xlAxisValue = (.Axes(Type.Missing, Excel.XlAxisGroup.xlPrimary))
xlAxisValue.Item(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).HasTitle = True
xlAxisValue.Item(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).AxisTitle.Font.Bold = True
xlAxisValue.Item(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).AxisTitle.Text = "Actual Efficiency %"
.Legend.Position = Excel.XlLegendPosition.xlLegendPositionBottom




Dim tpeSeries, oppSeries As Excel.Series
tpeSeries = .SeriesCollection(1)
oppSeries = .SeriesCollection(2)
tpeSeries.Interior.ColorIndex = 10
oppSeries.Interior.ColorIndex = 3
If rollup Then
tpeSeries.Name = "TPE"
oppSeries.Name = "Opportunity"


End If
End With

I have checked the web and found many examples but the syntax does not seem to work. I am trying to use Excel.XlCategoryType.xlCategoryScale to get the X variables to scale by category so there are not large gaps between data plots since these are weekly totals. Any suggestions would be great


Thanks,
Apr 24 '07 #1
0 2496

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
8
by: deko | last post by:
When using automation (and especially with early binding) I've heard it is best to use explicit references to everything. For example: Dim xlChart as Excel.Chart rather than Dim objChart...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
1
by: Robin Tucker | last post by:
Heres and interesting problem: I have a VB.NET program that creates reports via. Word Automation. This all works fine. What I want to do as part of this report generation process is to embed a...
1
by: Randall Arnold | last post by:
I'm converting a vbscript program to vb.net. Witht he exception of .net idiosyncrasies, most of it is working well with the same code. My only problem is that some properties and methods are...
0
by: damian.mcbride | last post by:
I am using C# to take data from a database and place in an Excel 2003 spreadsheet. Depending on the user query the data can be anything from a few rows to 1000 rows. The Excel 2003 sheet is a...
9
by: AGP | last post by:
I have a VB6 application that has an OLE container with an embedded Excel chart. Our office updated to Excel 2007 and now although the app works the charts looks like crap. Since the app is fairly...
1
by: Ally | last post by:
Hi all, I’m looking to plot charts in Excel from python. After some Googling I’ve found the following code: def plot(x, y, xAxisLog=False, yAxisLog=False): # acquire application object, which...
2
by: LucasLondon | last post by:
Hi, I'm trying to use VBA to extract underlying data from charts in powerpoint to excel, i.e from the underlying powerpoint datasheet that feeds the chart. I've found the macro below on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.