Hi,
Can anyone please help me in figuring out what change needs to be done to the below code in order to show the chart (the chart I want is displayed only when I click the "Switch Row/Column" button on the toolbar, I want it to be displayed automatically without manually clicking the button - please see the attached file). Below is my code: -
Private Sub DisplayGraph()
-
Try
-
Dim xlApp As Excel.Application
-
Dim xlWorkBook As Excel.Workbook
-
Dim xlWorkSheet As Excel.Worksheet
-
Dim misValue As Object = System.Reflection.Missing.Value
-
-
xlApp = New Excel.ApplicationClass
-
xlWorkBook = xlApp.Workbooks.Add(misValue)
-
xlWorkSheet = xlWorkBook.Sheets("sheet1")
-
xlApp.Visible = True
-
-
'Adding Data..
-
xlWorkSheet.Cells(1, 1) = 2
-
xlWorkSheet.Cells(1, 2) = 1
-
xlWorkSheet.Cells(2, 1) = 3
-
xlWorkSheet.Cells(2, 2) = 2
-
xlWorkSheet.Cells(3, 1) = 2
-
xlWorkSheet.Cells(3, 2) = 5
-
xlWorkSheet.Cells(4, 1) = 4
-
xlWorkSheet.Cells(4, 2) = 7
-
xlWorkSheet.Cells(5, 1) = 8
-
xlWorkSheet.Cells(5, 2) = 2
-
xlWorkSheet.Cells(6, 1) = 5
-
xlWorkSheet.Cells(6, 2) = 3
-
-
Dim oChart As Excel._Chart
-
oChart = xlWorkBook.Charts.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value)
-
-
oChart.ChartWizard(xlWorkSheet.Range("A1", "B6"), Excel.XlChartType.xlXYScatterLines, Missing.Value, _
-
Excel.XlRowCol.xlRows, _
-
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, _
-
Missing.Value, Missing.Value)
-
Catch ex As Exception
-
MessageBox.Show(ex.Message)
-
End Try
-
-
End Sub
-
Any help is highly appreciated.
Regards,
Aads
0 1261 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
by: mscir |
last post by:
Date: Thu, 08 Jul 2004 17:02:27 -0700
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <10ero4l3kp2qa65@corp.supernews.com>
Reply-To: mscir@usa.com
User-Agent: Mozilla/5.0...
|
by: cfriedalek |
last post by:
I'm driving Excel from python, largely successfully. Now I'm trying to
add errorbars to XY scatter plots. Keep getting a com_error. Can't
track down the problem.
I modified a simple example to...
|
by: Takeadoe |
last post by:
I'm doubtful that the group is unbiased, but I will ask anyhow :o). If
one intends to plot lots of data, primarily XY line and scatter plots,
and mass produce them (in many cases I will be doing...
|
by: Hendri Adriaens |
last post by:
Hi,
I'm trying to automate the creation of an excel file via COM. I copied my
code below. I read many articles about how to release the COM objects that I
create. The code below runs just fine...
|
by: grant |
last post by:
I'm trying to use a scatter chart to plot level reading for a pump
station level sensor.
The sensor takes a reading every 4 seconds, and there are 23,000
reading per chart
There appears to be...
|
by: Phil Stanton |
last post by:
I have a form with a button which is supposed to open an Excel file (With
lots of Macros /VBA) in it. The Excel file gets it's data from the Access
program
Here is the code
Private Sub...
|
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...
|
by: DaveD170 |
last post by:
Hi everybody,
I'm newbie in c# and I'm having trouble in creating an excel chart.
I have vector of data that my program calculated.
It's in the next format:
X Y
0.1 100
0.2 90...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |