By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,688 Members | 1,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,688 IT Pros & Developers. It's quick & easy.

Automating an excel chart using vb.net

P: n/a
I am trying to automate a Vb.net chart using the excel COM object. The
problem occurs when trying to run the code in different systems. It is
working fine under one of my computers but once i move it to another
one it fails giving me the error:

Additional information: Unable to set the HasMajorGridlines property of
the Axis class
Here is a excerpt of the code being run.
0001 Public Sub displayGraph()
0002
0003 Dim xChart As Excel.Chart
0004 Dim xChartRange As Excel.Range
0005 Dim cCell As Excel.Range
0006 Dim cAxis As Excel.Axis
0007 Dim cArea As Excel.ChartArea
0008 Dim fFormat As Excel.FillFormat
0009 Dim cShape As Excel.Shape
0010 Dim sLocation() As String
0011 Dim sRow As String
0012
0013 'loop through all of the graphs
0014 sLocation = Split(graphLocation, ";")
0015
0016 For Each sRow In sLocation
0017
0018 'create chart
0019 xChart = wbWorkBooks.Charts.Add
0020 xChart.ChartWizard(wsCurrent.Range(label_column & sRow,

0021 label_column & sRow), , , Excel.XlRowCol.xlRows, , , False)
0022 xChart.ChartType = Excel.XlChartType.xlBarClustered
0023
0024 'Format the x-axis of the graph
0025 cAxis =
xChart.Axes(Excel.XlCategoryType.xlCategoryScale,
0026 Excel.XlAxisGroup.xlPrimary)
0027 cAxis.HasMajorGridlines = False
0028 cAxis.MaximumScaleIsAuto = False
0029 cAxis.MajorUnit = 50
0030 cAxis.MaximumScale = 200
0031 cAxis.MinimumScale = 0
0032 cAxis.TickLabels.Font.Size = 8
0033 cAxis.TickLabels.AutoScaleFont = False
0034 cAxis.TickLabels.NumberFormat = ""

The problem occurs on line 0027. Since this is working under a
different computer is anyone aware of additional software packages or
updates that need to be installed to make these properties accessible.
It seams that all properties of cAxis are unavailable.

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.