Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




OLE Excel Chart Object


Can someone help me in writing the code for the following results?

All I want to do is display an Excel chart in an OLE container. If I display the chart in an image control the graphics are very distorted. The OLE container displays much better. Here is the code I have for now.

If rs.EOF = True Then
Else
Set xlApp = New Excel.Application
xlApp.Workbooks.Open FileName:=rs("PathFileLocation").Value
Set currentchart = xlApp.ActiveChart
currentchart.CopyPicture xlScreen, xlBitmap, xlScreen
frmReferenceResults.imaRMChart.Picture = Clipboard.GetData
xlApp.DisplayAlerts = False
xlApp.ActiveWorkbook.Close SaveChanges:=False,_FileName:=rs("PathFileLocation").Value
xlApp.Quit
Set xlApp = Nothing
End If




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Copy A Chart From One OLE Excel Sheet To An OLE Excel Chart Object
Hi all,

Kinda stuck here and I have been searching for the way to do this all day. I have a spreadsheet with Charts in one VB OLE container (Excel.Sheet.8)and I want to copy one of the charts to another VB OLE container (Excel.Chart.8) and have it sized to fit in my OLE container. I cant seem to get it to work. Any help?

Where OLE1 = spreadsheets with charts
and OLE2 is a chart

Code:
OLE1.Class = "Excel.Sheet.8"
OLE1.SourceDoc = App.Path & "Data5.xlt"
OLE1.Action = 0
'... Work with the spreadsheet...
OLE2.Class = "Excel.Chart.8"
OLE2.Action = 0
Set OLE2.object = OLE1.object.Charts(1) 'Doesnt Work
OLE2.object.Height = 5000 'Doesnt Work
OLE2.object.Width = 10000

Excel Chart Object In VB
Hi,

In my program I have inserted an Excel chart (by going to Components, insertable objects and selecting excel chart). Anybody know how to update the values in the chart sheet?

Thanks

Excel VBA Guru's (Chart Object)
Hi,

I have a spreadsheet with quite a few charts.....

What I would like to do is change the value for the chart options:

1. X-axis value
2. Name (of the series) value
3. The values for the series themselves

Here is the code that the macro recorder produced (apart from the With's)


Code:
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart
.ChartArea.Select
.SeriesCollection(1).XValues = "=DATA!R14C1:R25C1"
.SeriesCollection(1).Values = "=DATA!R14C4:R25C4"
.SeriesCollection(1).Name = "=DATA!R2C4"
.SeriesCollection(2).XValues = "=DATA!R14C1:R25C1"
.SeriesCollection(2).Values = "=DATA!R14C5:R25C5"
.SeriesCollection(2).Name = "=DATA!R2C5"
end with



This works for the Xvalues but not for values and Name, the error I am receiving is the following

"Unable to set the values property of the series class"

Does anybody know why? or have any idea of other ways of changing the series values.. (The charts aren't embedded, I assume this makes a diffence i.e. whether you can use Chartobject or Charts !!)

I have even used the following


Code:
.seriescollection(1).Name = Worksheets("DATA").Range("A1:A25")



But that didn't work either (Seems to only work if you add a series, not amending an already existing one).... There must be a way to do this !!!! (He says)

Thanks for any help
Steve

Excel Chart Object In VB6 Form
Well, this IS the "Newbie" forum, so here's a newbie question...

I added the "Microsoft Excel Chart" Insertable Object component to my VB6 project and it added that new button to the Toolbox. When I used to button to add a chart object to a form, I got an object "Chart1". Right-clicking this object and selecting Edit reveals an Excel 'workbook' with a default chart on sheet 'Chart1' and the data producing the chart on 'Sheet1'.

This is probably not news to any of you, but my question is, now that this obejct is in my form and I've edited the chart to look like I want it to look, how do I 'talk' to it? In other words, using the VB form's objects and user interaction how can I alter the data in this Excel chart object to update the chart as needed? A hypothetical example... I want a value entered into a text box 'myTextBox' on my VB form to be copied into cell B1 of Sheet1 in the embedded workbook.

Can this be done?

Thank you,

Gary Lofgren

OLE Excel Chart Object.. DYNAMIC??
Is it possible to make the OLE Excel Chart object dynamic? I chose to make a chart using this object instead of instantiating a Excel.Chart and creating one from scratch. Now I'm concerned that I can't make if I want these to be dynamic then it can't happen.
What I do is use the OLE excel chart object and then edit it by filling in the excel spreadsheet with the data and then graphing and only displaying the graph as a sheet.

Hopefully someone can help me with this. I'm sure there are VB/OLE Excel guru's out there.


Thanks!
Essa

VBA Excel Chart Builder Object
Hello all,

     I'm still relatively new to VBA, so this should be a simple FAQ. I've noticed a lack of documentation on building excel charts. I especially noticed the lack of it when my company wanted me to build a vba application that would build charts based on employee performance since charts are a much more effective way of guaging your performance in relation to the company. At first I thought the project would be simple and the hardest part would probably be getting the data. Well, with the kind of data they were giving me, I found out that building the charts would be a virtual nightmare (at least for me). After alot of research (including alot of books I own), I didn't seem to find much to help me, so I started into some good ole fashioned trial and error. Since I would rather not have to reinvent the wheel, I built my results into a class module that I can reuse later on. I believe that in building this class module, I've found an excel chart bug. For some reason, the charts that were built would occassionally add on an extra empty series at the end of a chart. This would happen at random times with the exact same data (I quadrouple checked). So I included some code to debug this. Heres the code for the class module:

Code:
Sub BuildChart(ChartType As XlChartType, xvalues As Variant, chartValues As Variant, seriesName As Variant, chartName As String, Optional chartCaption As String = "", Optional chartLegend As Boolean = True, Optional chartLabels As Boolean = False, Optional AutoPatterns As Boolean = False, Optional color As Boolean = True, Optional LabelFontSize As Integer = 3)
'The prerequisites for building this chart is an Array that contains 2 or more Arrays for the chartValues argument, a single
'dimensional array for xValues. Be careful to make all the arrays either 1 based arrays becuase of the fact that
'this object is working with 1 based collections such as a chart series.

Dim PatternArray(1 To 19) As MsoPatternType
PatternArray(1) = msoPatternZigZag
PatternArray(2) = msoPatternSmallCheckerBoard
PatternArray(3) = msoPatternSolidDiamond
PatternArray(4) = msoPatternSphere
PatternArray(5) = msoPatternWeave
PatternArray(6) = msoPattern30Percent
PatternArray(7) = msoPatternHorizontalBrick
PatternArray(8) = msoPatternDarkDownwardDiagonal
PatternArray(9) = msoPatternPlaid
PatternArray(10) = msoPatternShingle
PatternArray(11) = msoPatternNarrowHorizontal
PatternArray(12) = msoPatternDarkUpwardDiagonal
PatternArray(13) = msoPattern80Percent
PatternArray(14) = msoPatternSmallGrid
PatternArray(15) = msoPatternLargeCheckerBoard
PatternArray(16) = msoPatternTrellis
PatternArray(17) = msoPatternDarkHorizontal
PatternArray(18) = msoPatternDiagonalBrick
PatternArray(19) = msoPatternOutlinedDiamond

Dim myseries As SeriesCollection
Dim mychart As Chart
Dim i As Integer

Set mychart = Charts.Add
    If chartName <> "" Then
        mychart.Name = chartName
    End If
    'Set the chart type
    mychart.ChartType = ChartType
    Set myseries = mychart.SeriesCollection
    'Object requires a 2 Dimentional Array that stores the arrays for the values
    If UBound(chartValues) = 1 Then
        myseries.NewSeries
        myseries.Item(1).Name = seriesName(0)
        myseries.Item(1).Values = chartValues(0)
    Else
        For i = LBound(chartValues) To UBound(chartValues)
            myseries.NewSeries
            myseries.Item(i).Name = seriesName(i)
            myseries.Item(i).Values = chartValues(i)
        Next
    End If
    'Compensate for chart bug
    If myseries.Count > UBound(chartValues) Then
        Do Until myseries.Count = UBound(chartValues)
        myseries.Item(myseries.Count).Delete
        Loop
    End If
    mychart.Axes(xlCategory).CategoryNames = xvalues
    If chartLabels = True Then
        mychart.ApplyDataLabels Type:=xlDataLabelsShowLabels, AutoText:=True, LegendKey:=False, ShowValue:=True
    End If
    If chartCaption <> "" Then
        mychart.HasTitle = True
        mychart.chartTitle.Caption = chartCaption
    End If
    mychart.HasLegend = chartLegend
    If AutoPatterns = True Then
        For i = 1 To myseries.Count
            ActiveChart.SeriesCollection(i).Select
            Selection.Fill.Patterned Pattern:=PatternArray(i)
            If color = False Then
            With Selection
                .Fill.Visible = True
                .Fill.ForeColor.SchemeColor = 15
                .Fill.BackColor.SchemeColor = 2
            End With
        End If
        Next i
    End If
    
    'Label Font Size
    If chartLabels = True Then
        If LabelFontSize > 0 And chartLegend = True Then
            For i = 1 To myseries.Count
                myseries.Item(i).DataLabels.Select
                Selection.AutoScaleFont = True
                With Selection.Font
                    .Name = "Arial"
                    .FontStyle = "Regular"
                    .Size = LabelFontSize
                    .Strikethrough = False
                    .Superscript = False
                    .Subscript = False
                    .OutlineFont = False
                    .Shadow = False
                    .Underline = xlUnderlineStyleNone
                    .ColorIndex = xlAutomatic
                    .Background = xlAutomatic
                End With
            Next i
        End If
    End If
    
    'Set the Legend Size
    mychart.Legend.Select
        With Selection.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 14
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With
    
    'Set the width and height
    mychart.PlotArea.Select
    Selection.Top = 1
    Selection.Height = 453
    Selection.Left = 1
    Selection.Width = 677
End Sub


Here is the code in the module that uses the class module:
Code:
Sub test()
'This code is set up for a black and white printer, but can be changed to color, and solid
'patterns by changing the color argument to True as well as the autopatterns argument

Dim x As New ChartBuilder
Dim overall(1 To 2) As Variant
Dim y(1 To 3) As Integer
Dim z(1 To 3) As Integer
Dim strSeriesNames(1 To 3) As String
Dim intXvalues(1 To 3) As Integer

y(1) = 4
y(2) = 5
y(3) = 6

z(1) = 5
z(2) = 6
z(3) = 7

strSeriesNames(1) = "a"
strSeriesNames(2) = "b"
strSeriesNames(3) = "c"

intXvalues(1) = 1
intXvalues(2) = 2
intXvalues(3) = 3

overall(1) = y()
overall(2) = z()

Call x.BuildChart(xl3DColumn, intXvalues, overall, strSeriesNames, "My Chart", "My Chart Caption", True, True, True, False, 8)

End Sub


This class module works best if you use 1 based arrays since your working with 1 based collections such as the chart series collection. I also had to have the option to print from a black and white printer (cheap mana--- I mean,,, cost effective management ), so I included an argument called autopatterns to automatically pattern the charts, and also an argument to make the chart black and white. There are a few other features which I will not go into detail here. This is my first shot at this, so I welcome any feedback as I'm sure this is anything but perfect.

I've tested this with the following charts with success. There are several charts that will not work with this code. Hope this helps someone!!

xlBarClustered
xl3DBarStacked
xl3DBarStacked100
xl3DColumn
xl3DColumnClustered
xl3DColumnStacked
xlArea
xlAreaStacked
xlAreaStacked100
xlConeClustered
xlConeBarStacked
xlConeBarStacked100
xlConeCol
xlConeClustered
xlConeColStacked
xlConeColStacked100
xlCylinderBarClustered
xlCylinderBarStacked
xlCylinderBarStacked100
xlCylinderCol
xlCylinderColClustered
xlCylinderColStacked
xlCylinderColStacked100
xlDoughnut
xlDoughnutExploded
xlLine
xlLineMarkers
xlLineMarkersStacked
xlLineMarkersStacked100
xlLineStacked
xlLineStacked100
xlPyramidBarClustered
xlPyramidBarStacked
xlPyramidBarStacked100
xlPyramidCol
xlPyramidColClustered
xlPyramidColStacked
xlPyramidColStacked100
xlRadar
xlRadarFilled
xlRadarMarkers
xlXYScatter
xlXYScatterLines
xlXYScatterLinesNoMarkers
xlXYScatterSmooth
xlXYScatterSmothNoMarkers

Object Microsoft Excel Chart
I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.

I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.

My problem is "am not able to select the sheet in the object(Chart1)"

I will like to take data in DBGrid and put them in Sheet1 to make new chart.

Help me !

Sorry for my english
Thanks
Redg

Object Microsoft Excel Chart .....
I asked 5 times about this question and I'm not resolve my problem. Who can help me?

I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.

I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.

My problem is "am not able to select the sheet in the object(Chart1)"

I will like to take data in DBGrid and put them in Sheet1 to make new chart.

Help me !

Sorry for my english
Thanks
Redg

Object Microsoft Excel Chart
I puted graph in my form1 "Microsoft Excel Chart" and I would like to change data in graph but I don't know what can I do that.

I try with:
Chart1.Worksheet("sheet1").Select
Chart1.Activesheet.Cells(2, 3).value = 10
or
Chart1.sheet1....
or
Chart1. ??? but not succes because each time I recieved this error "method or data member not found"

In the object I have one graph and one sheet. The graph was make with data in sheet1 and I will like to change data in Sheet1 but how?

Who can help me?

Thanks

Redg

Add A Range To An Excel Chart Object!
Hiya!


I have an excel chart object in vb5 and in the excel sheet I have some columns that I want to be the input for the chart.

Getting the values is easy, just have to use Range command but how do I connect them to the chart object so it uses that specified range for the chart?


Thanks for any help.

Magnus

Embedded OLE Excel Chart Object.. DYNAMIC??
Is it possible to make the OLE Excel Chart object dynamic? I chose to make a chart using this object instead of instantiating a Excel.Chart and creating one from scratch. Now I'm concerned that I can't make if I want these to be dynamic then it can't happen.
What I do is use the OLE excel chart object and then edit it by filling in the excel spreadsheet with the data and then graphing and only displaying the graph as a sheet.

Hopefully someone can help me with this. I'm sure there are VB/OLE Excel guru's out there.


Thanks!
Essa

Embedded OLE Excel Chart Object.. DYNAMIC??
Is it possible to make the OLE Excel Chart object dynamic? I chose to make a chart using this object instead of instantiating a Excel.Chart and creating one from scratch. Now I'm concerned that I can't make if I want these to be dynamic then it can't happen.
What I do is use the OLE excel chart object and then edit it by filling in the excel spreadsheet with the data and then graphing and only displaying the graph as a sheet.

Hopefully someone can help me with this. I'm sure there are VB/OLE Excel guru's out there.


Thanks!
Essa

Problem In Dynamically Using The Excel Chart Object?
hi,

i have an application which is designed to do data anlaysis and display the data in various formats like graphs ,excel reports.

while designing the excel report i have to export the data from visual basic and for that data i have to plot the graph on the chart object by code

for example i have data which i exported to excel.the data is shown below.
FSDevice1Device2Device3Device4Device5
1256.543484.2265416.6438536.5191874.643987
2504.7021574.1724797.2056346.3247515.900553
5005.3084536.1017288.1564877.701377.779077


now iam trying to plot the data using excel chart object...

Set objChart = objSheet.ChartObjects.Add(100, 100, 500, 200)
objChart.Chart.ChartType = xlLine
Set xlseries = objChart.Chart.SeriesCollection


'''''for the y series''''''''''
xlseries.Add Source:=objBook.Sheets(strName).range("B2:B4")
xlseries.Add Source:=objBook.Sheets(strName).range("C2:C4")
xlseries.Add Source:=objBook.Sheets(strName).range("D24")
xlseries.Add Source:=objBook.Sheets(strName).range("E2:E4")
xlseries.Add Source:=objBook.Sheets(strName).range("F2:F4")


'''''for the X series''''''''''

For i = 1 To xlseries.Count
xlseries.Item(i).XValues =ObjBook.Sheets(strName).range("A2:A4")
xlseries.Item(i).Name = "D" & i
Next i


but the problem is the data is dynamic.so iam when iam trying to pass the values in the form of range the application is giving error like "Application Error or User Defined Error".

and i donot know the exact range of cells ie from where the cell starts and where the cell ends and how many cells are there.

bcos the data is dynamic ?????

could any body tell me how to pass dynamically the data into series collection.


regards

varma

Urgent... Object Microsoft Excel Chart
I asked 5 times about this question and I'm not resolve my problem. Who can help me?

I put object Microsoft Excel Chart in my form and the chart was build with sheet1 situate in the object Chart1 but I will like to change data on sheet1 to make a new chart but I not able.

I try with Worksheet("Sheet1").cells(2, 3).value = new value but I receive all the time this error "Method or data member not found" for Worksheets.

My problem is "am not able to select the sheet in the object(Chart1)"

I will like to take data in DBGrid and put them in Sheet1 to make new chart.

Help me !

Sorry for my english
Thanks
Redg

Controlling Position Of A Drawing Object On An Excel Chart
I have a line chart that is an on-going time series chart. Each month I add another data point to the series. I currently have a vertical line drawn on the chart crossing one of the data points representing when an event occurred. I have everything working except how to determine how much (where) to move the line to stay with that month's data point as the points get shifted due to the addition of the new point.

I've looked at all the properties of the Point object hoping to find something like an (x,y) coordinate positioning on the chart (I thought I could use the same x coordinate for my object). But, I can't find anything that seems to work. Does anyone have any ideas to try?

Excel - Chart Object - Category X Axis Labels
I have a chart object generate in VBA as follows:

With ChartObject
        'Set up Chart Title
        .HasTitle = True
        .ChartTitle.Text = ChartTitle
        
        'Set up Source Data
        .SetSourceData Source:=SourceData, _
            PlotBy:=xlColumns
        
        'Set up Y1 Axis Title
        With .Axes(xlValue)
            .HasTitle = True
            .AxisTitle.Text = YAxisTitle
            .MinimumScale = Module1.SetScaleValues(LCL, "Deflate", 20) 'Set Minimum Scale to 20% less than LCL
            .MaximumScale = Module1.SetScaleValues(UCL, "Inflate", 20) 'Set Maximum Scale to 20% more than UCL
        End With

End With

I am passiing in the variables which contain my sources etc.

What I am unable to get working is to set each value on the x axis to look up the value in my first column in the data range (my index). So when you hover the mouse cursor over a data point - it tells you which index (X value) the point relates to.

If you manually set this in a chart - through the qizard - it automatically sets the x axis category labels as the first column. My code sets all columns as the series. I dont want the first columns as the series at all.

Any help would be much appreciated.

Thanks....

How To Link Excel Chart Object Generated With VB To Access Field
Hello,
Sorry, I am new to VB and Database. I generated an OLE control on my panel, and embeded a Excel Chart into it, which shows my calculated result. And I want to send this Excel chart back to one field of my Access table. How could I realize this?
In Access, we could manually insert object, the using Browse to choose the Excel file, making it linked to the field, which has OLE object as its data type. However, how could I realize the whole set of movement with my VB programming?
Experts, please help.



Display An Excel Chart In An "insertable Excel Object"
I am programming in VB6 and I would like to display the contents of an excel chart in my VB application.
I guess I can do it using an "insertable excel object". BUT I can not figure out how it works!!
Is there is another easy way to do it without using these "insertable objects"??

Any help is welcome

Create Chart In Access Using Chart Object
Code:

Dim rpt As Access.Report
Dim ctlObjFrame As Access.ObjectFrame
Dim SQL As String
Dim cw_rs As DAO.Recordset

SQL = "SELECT (Format([Date1],'DDDDD')),Sum([Events]) AS [SumOfEvents] FROM [Data] GROUP BY (Int([Date1])),(Format([Date1],'DDDDD'))"
Set rpt = CreateReport
Set ctlObjFrame = CreateReportControl(rpt.Name, acObjectFrame, , "", "", 100, 100)
Set cw_rs = CodeDb.OpenRecordset(SQL, dbopendynaset)
cw_rs.MoveFirst
ctlObjFrame.OleData= cw_rs!ChartObject
DoCmd.Restore
I got the above code from a site. It creates a new report & an objectFrame. But during run-time it gives error in "ctlObjFrame.OleData" as "Items not found in the collections" error. Can anyone please tell me why i get this error.

Draw Bar Chart ,pie Chart In Excel Using Vb
i want to draw pie,bar chart in excel using vb. database is ms access. pls advise me.

Pie Chart Or Object In Action
Edit by 00100b:
Split from this thread.

Wow, that example is just incredibly amazing! I was wondering if you could put up an example on how control an altimeter such as is displayed in the attachment.
To keep the example simple, don't worry about the orange PNEU box or the box next the number 3 which displays 1013 or the little key hole in the lower right corner or the little round circle in the lower left corner. The altimeter displays the altitude in feet. Then numbered box in the center displays feet. one revolution would be 1,000 feet.

Depending on how difficult it looks, I might try learn how to program graphics.

If anyone has an example to show, I thank you very much for your time.

Shawn

Pie Chart Or Object In Action
Guys,

This is probablly the most complicated part here, but I was hoping I could get some help from those experience VB6 programmers. My target goal on this project is to create gauge or indication control for simulation environment. at this point I am trying to create aircraft gauge control which will have computerized type of display in today aircraft where it'd call "glass cockpit. I am sure some of you may seen it before, and some of you don't. I am going give my best to explain you in words. Actually, it's hard to explain pictures in words... but not to worry I have attached picture at below so you all can get the idea.
Assumedly, there is attached picture called EX1, there is two categories on same picture showing before needle make movement, and other one after needle movement. So, The first part of picture (top) you can see needle is at "rest point" labeled with "0" which shown that value hasn't been implemented as of yet. Also, there isn't any filling there yet. So, technically it means the aircraft engine is off... Now the second part of EX1 picture at (below) show after movement of needle where it already have filling after or behind the needle with value of '79.80' you can obviously tell that engine is already on. So what I am trying to do is understand how I could wirite source code getting needle with filling to render the time intervial based on value supplied from simulator program from needle.
Some of you may wonder what kind of runtime application that can get or sent values... Well, honestly... I don't know... But I didn't have to worry because someone already wrote the code and interact with simulator software called FSUIPC (Flight Simulator Unversal Inter-Process Communicator) Its a software that communicate from one program (e.g.VB6) to another program (e.g. Simulator Program) at run time.
Anyway, for the starter...I have browsed through so many search engine trying to find how i could make needle movement based on value, and I have sucessfully wrote the code, it does work at runtime while interact with simulator program.


Code:
Here's the code:
*NOTE: Bold text is the standard requirement of prodecures to get it at run time, based on .BAS files in module folder.


visual basic code:

Option Explicit

Dim OilPSI As Double
Dim OilPsiAngle As Double
-------------------------------------------------------------------
Private Sub Timer1_Timer()

Call FSUIPC_Read(&H3B60, 8, VarPtr(OilPSI), dwResult)
OilPSI = OilPSI / 144#

capOil.Caption = Format(OilPSI, "0")

If OilPSI < 60 Then
OilPsiAngle = 0 - ((60 - OilPSI) * 0.75)
picOil.Cls
Else
OilPsiAngle = ((OilPSI - 60) * 0.75)
picOil.Cls
End If

OilPsiAngle = OilPsiAngle * (3.1412 / 180)

picOil.CurrentX = 1500
picOil.CurrentY = 750

picOil.Line Step(0 - (500 * Cos(OilPsiAngle)), (0 - 500 * Sin(OilPsiAngle)))-Step(0 - (250 * Cos(OilPsiAngle)), (0 - (250 * Sin(OilPsiAngle))))

Call FSUIPC_Process(dwResult)
End Sub


These working code creates needle movement based on assigned value that is supplied though simulator program.
Now, Again...I've browsed through many search engine and found example on creating pie chart. but it doesn't go on runtime. I assume, this code probablly give me some ideas or theories on creating filling on gauges so here's code example of two pie charts that has fillings.



Code:
visual basic code:

Option Explicit

Const PI = 3.14159265
--------------------------------------------------------------------
Private Sub Form_Load()
Const R As Double = 500
Const GAP As Double = 5
Dim X As Double
Dim Y As Double

AutoRedraw = True

'Northeast wedge'
X = R
Y = R
FillStyle = vbFSTransparent
Circle (X, Y), R, vbWhite
FillStyle = vbFSSolid
Circle (X, Y), R, vbRed, -PI / 6, -PI / 6 * 2

'Everything Else'
X = X + 2 * R + GAP
FillStyle = vbFSTransparent
Circle (X, Y), R, vbWhite
FillStyle = vbFSSolid
Circle (X, Y), R, vbRed, -PI / 6 * 2, -PI / 6

End Sub


So, I guess that probablly give me surface start on getting familar with codes between moving needle and pie chart with fillings. But at this moment I am still unable to find out how to write code getting needle to fill in after movement... Can anyone outhere help me out here? maybe help me out sharing codes or showing me how getting rendering filling after needle movement at time intervial... (It doesn't have to be FSUIPC runtime for now)
Any help or ideas from you will be greatly appreicated. If you have any other question please feel free to ask.

Add Text To Chart Object Using VB?
I have a chart sheet as a member of a workbook and the boss man wants me to add a model number to this chart. Is there any way I can add text to a sheet that is a chart object and not a normal sheet? Can I edit the chart title through VB? If I can make changes to that it would work.

Thanks.

Chart Object Failed
I recorded a macro for creating a surface chart. I then run the macro but get the run-time error 1004 (Object Failed)

Below is the macro I recorded, the error is indicated for the line: ActiveChart.ChartType = xlSurface

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 11/09/2003 by NES
'

'
Charts.Add
ActiveChart.ChartType = xlSurface
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("I219")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R17C1"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R2C3"
ActiveChart.SeriesCollection(1).Name = "=Sheet1!R2C2"
ActiveChart.SeriesCollection(2).XValues = "=Sheet1!R17C1"
ActiveChart.SeriesCollection(2).Values = "=Sheet1!R17C3"
ActiveChart.SeriesCollection(2).Name = "=Sheet1!R17C2"
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="EFwoSSwW2"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = _
"Efficient Frontier with Widths and without Short Sales"
.Axes(xlCategory).HasTitle = True
.Axes(xlCategory).AxisTitle.Characters.Text = "Sigma"
.Axes(xlSeries).HasTitle = True
.Axes(xlSeries).AxisTitle.Characters.Text = "Mean"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Characters.Text = "Width"
End With
End Sub

Ms Chart Object And Rnd Function
I have 2 question
1)I want to choose a random number between 3800 to 4200 how can I do that?(rnd function)
2) I have a MS Chart control(line style).I have 25 rows in my chart, I want to paint the data on rows number 5 and 10
on a blue colour,and the other points,on a red colour.
I code
"Ms chart1.Plot.SeriesCollection.Item(1).DataPoints.Item(-1).Marker.Pen.VtColor.Set 0, 0, 255"
but this is not for specific point!!!
How can I do that?

Excel Chart - Paste Special As Picture In Excel Itself
Hi All,

I am working on a report and it needs to be generated daily. After generating and creating charts, I need to paste special those charts as "Pictures". Is there any way to do this? And also i need to paste special every single chart in the work book. I already done a code but it not working properly.. and the important point is i need to paste special the chart at the exact position where i intended to cut. Is this possible???

Pls treat this as emergency and advice me on this.

Thanks in advance..

Regards
Mohan

Excel 2000, Create Powerpoint Org Chart From Excel.
I want to create a powerpoint org chart from Excel using information held in Excel. I have found how to add an Org chart into Powerpoint but can't find anywhere that tells you how to change the details/options or add Subordinates Managers etc and alter those details.

Anyone have any ideas (I don't want to create seperate text boxes if possible.)

Ps if you can create a good powerpoint org chart from excel, any ideas on the best layout of information in the spreadsheet to work through and create it.

This is one of those, that would be good if you can do it (created them in the past and are time consuming pains), rather than has to be done last week ideas.

Regards.

rob.

Object Name For Trendline Equation And R^2 On OWC Chart?
I created an XY chart in an OWC11 chart space, added a trendline and set .IsDisplayingRSquared = True. Does anyone know how to refer to that R-Squared label/caption in VBA. I can format the font style, size and color manually, but can't find the label/caption's object name in the OWC documentation. Thanks in advance.

MS Chart Object - XY Line (Cartesian)
Morning all,

I'm stuck - plain and simple...

I've seen a couple of posts in the forum relating to this yet nobody has been able to answer it...

Here's hoping...

I am wanting to plot an xy line chart )cartesian coordinates.

so x = 1.13 y= 2.26

MS Chart wants to plot my arrays as two ines...

I have used - as far as I am aware - all the correct properties...

charttype = VtChChartType2dXY
seriestype=VtChSeriesType2dXY

Still to no avail - any ideas...?

Thanks

Andrew

ps - Anybody at Edinburgh Uni here..?

Microsoft Chart Space Object
I am using MS chart space object in my ASP page to display a bar chart with different Country's GDP along Y-axis (left) and Country's name along X-axis (bottom). Some country's name are too long and hence I want to display all country's name vertically along the X-axis instead of horizontally. I could not able to find any property or method to achieve that. Could any one please help me to know if there is such property or method to achieve this result.

Passing Data To Chart Object On Form
I want to be able to continuously chart data on a "Chart" object on a form. This chart looks exactly like a chart in Excel, but I don't want to use Excel. I can easily see how to edit the chart's data at design time, but can I edit it during runtime? This object is perfect for me because it auto scales and I can make it wide to accommodate several-hour tests. Attached to this post are two pictures... one of the chart itself and one that shows real time data. I'd like to log the data using the chart object. Is this possible?

Seriescollection.delete Fails In VB6 Chart Object
Dear All,

I have a funny problem. I've embedded an Excel Chart OLE object in my vb6 form. I can do everything I want with this object, except delete seriescollections. I can addnew seriescollections, but I get an error when I try to delete a series. Here's my code:

Set objC = Me.olePKPlot.object
int1 = objC.Charts("Chart1").SeriesCollection.count 'for info purposes
Do Until objC.Charts("Chart1").SeriesCollection.count = 1
objC.Charts("Chart1").SeriesCollection(1).Delete
int1 = objC.Charts("Chart1").SeriesCollection.count 'for info purposes
Loop

I get this error when the delete action executes:

Run Time Error 1004
Delete Method of series class failed

The delete command works in an Excel vba macro, but doesn't seem to want to work in my VB6 application.

All help is, as always, greatly appreciated.

Thanx!

How To Feed Access Chart Object With Data?
Ok, for MS Access I am able to programatically feed data to an ActiveX MS Chart Control v6.0. The problem is the user doesn't have that ActiveX control installed on their machine, and installing it would require updating the registry which I'm NOT allowed to do. So I need to use the other type of chart (graph) Access provides (the chart from the Insert menu).

I've tried feeding this chart data from a 2-D array, and also directly from the Access tables using DAO, then ADO but I get errors and the project won't run in either case. Anyone know how to use VBA to feed this chart data with either a 2-D array or a recordset?

Thanks

Shannon

Copy Excel Chart From Excel To Word?
I need the code to copy an excel chart from an Excel sheet to a word doc.

Could it be something like:

ActiveChart.Copy ???

Changing Line Color Of Crystal Report Chart Object
Hi,
The following problems encountered while plotting the line graph in crystal report.

Dev Environment: Visual Basic .NET 2003
Graph object used: Crystal report chart

Pb1) I want to change the line colors in plots. There are five to six variables in my graph. The object assigns random colors to the line. Many times two lines are drawn by same color. How do I change the line color in chart object?

Pb2) In the same chart I want to change the legend names. As per "ReleaseNotes.Doc" document this problem is fixed in crystal report Ver 9.0("ReleaseNotes.DocADAPT 13986"). I am using the "9.1.5000.0" version. (This is what it shows on all crystal report dlls). How do I change the legend names?

Thanks in advance for the information you will provide.

Regards,
Ani

Excel Chart In VB
i want to make a form and an exe file after that

where there are 6 text boxes where i key in value and submit
when i submit the chart also in the same form takes the value and draws the graph.

the chart is an excel chart
embedded in the form,

i am able to do this using the VB editor in excel
like
Sheets("Sheet1").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = TextBox1.Value

Chart1. is the object in my form
how do i call it and select the sheet1 and do the same like i did in excel

please help,
i also tried the OLE way, but also not sure how to do

thanks,
darcher

Excel Chart
I've been working on an excel file for a while and have been getting quite a bit of help from everyone here. I added a chart to my file and I wanted to tweak it a little. The Y axis is in seconds and I would like to have a red line drawn all the way across the chart at the 60 seconds mark. As I said before the y axis is seconds and it changes if I have large or small amounts for in my series. Sometimes it goes from 0 to 100 or sometimes its from 0 to 2000. So as you can see the red line will need to move up and down as the chart changes.


Is this even posible?


If not, Thanks anyway.

Excel Chart
Ok ... i currently have my code drawing from an array with 2 cols .. this produces a chart with the two sets of variables plotted on the y axis against incremental x values that excel has set up (ie 1 2 3 4 ....)

Now .. what i want to do is keep the 2 y series ... but make the x axis my own values.....

here is my code



Dim Counter As Integer

Counter = 1
Do While Counter <= N
grdAnalytical.Row = Counter
grdAnalytical.Col = 2
grdAnalytical.Text = MatrixOutput(Counter)
arrOut(2, Counter) = MatrixOutput(Counter)
Counter = Counter + 1

Loop

'------------Excel Chart---------------------------------------'

Dim oXL As Object ' Excel application
Dim oBook As Object ' Excel workbook
Dim oSheet As Object ' Excel Worksheet
Dim oChart As Chart ' Excel Chart

Dim iRow As Integer ' Index variable for the current Row
Dim iCol As Integer ' Index variable for the current Row

Dim cNumCols As Integer ' Number of points in each Series
Dim cNumRows As Integer ' Number of Series

cNumRows = 2
cNumCols = N

ReDim aTemp(1 To cNumRows, 1 To cNumCols)

'Start Excel and create a new workbook
Set oXL = CreateObject("Excel.application")
Set oBook = oXL.Workbooks.Add
Set oSheet = oBook.Worksheets.Item(1)

oSheet.Range("A1").Resize(cNumRows, cNumCols).Value = arrOut

'Add a chart object to the first worksheet
Set oChart = oSheet.ChartObjects.Add(50, 40, 400, 300).Chart


With oChart 'or you could use ActiveChart

.ChartType = xlLine
.SetSourceData Source:=oSheet.Range("A1").Resize(cNumRows, cNumCols)
.HasTitle = True
.ChartTitle.Characters.Text = "Method Comparison"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Node"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Temperature"
.SeriesCollection(1).Name = "=""Analytical"""
.SeriesCollection(2).Name = "=""Finite Differences"""
With oChart.Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = True
End With
End With

'Make Excel Visible:

oXL.Visible = True

Excel Chart PLEASE PLEASE HELP !
ok ... below is my code ... which does produce a graph just fine ... the problem is trying to add a title or change the graph type ...

i have tried adding

oChart.hasTitle = TRUE
oChart.Title.Caption = "Whatever"


and it always gives me errors .... how can i add a title and change the graph type !! PLEASE


-----------------------------------------------------------------------------------

Dim oXL As Object ' Excel application
Dim oBook As Object ' Excel workbook
Dim oSheet As Object ' Excel Worksheet
Dim oChart As Object ' Excel Chart



Dim iRow As Integer ' Index variable for the current Row
Dim iCol As Integer ' Index variable for the current Row

Dim cNumCols As Integer ' Number of points in each Series
Const cNumRows = 2 ' Number of Series

cNumCols = N

ReDim aTemp(1 To cNumRows, 1 To cNumCols)

'Start Excel and create a new workbook
Set oXL = CreateObject("Excel.application")
Set oBook = oXL.Workbooks.Add
Set oSheet = oBook.Worksheets.Item(1)

oSheet.Range("A1").Resize(cNumRows, cNumCols).Value = arrOut

'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)

' Make Excel Visible:
oXL.Visible = True

oXL.UserControl = True

-------------------------------------------------------------------------------

Note: this example is on the microsoft page ... so you can try adding the title code to that if u want to get it working ... the microsoft example generates a random array...

Excel Chart
Hello!
i want to combine Excel Chart in my form!
the Chart data are stored in recordset(query result).
how can i do so?
expample wil be nice to have!
thank you alot in advance

Excel Chart
I have written a VB program which sends a two dimensional array of numbers to an Excel file. This data is then graphed on arrival using VBA code.

How do i make this Excel chart appear on my VB form aswell?

Excel Chart Using ADO?
Hi to all thread viewers,

Is there any possibility of creating an excel-chart using "ADO"........

If yes, please give me some hints...

Thank you in advance..

Using The MS Excel Chart In VB - ?
Could anyone point me to a good resource for using MS Excel chart in vb
or give some sample codes on things like how to change the axis labels /values how to plot points on the graph (multiline) etc

Cheers

Excel Chart In VB
hi.

i'm creating an excel chart in VB. In excel, you can set the
property : "Value(y) crosses between dates" to have excel
plot date values in between the tick marks. Setting this property
to false makes excel plot the date values to correspond to actual
tick marks.

Is this property exposed in the Excel object in VB? I need to set this
to false.

Also, how do i add minor tick marks to an excel chart
from VB?

Thanks, any help would be greatly appreciated.

Excel Chart
hi all,

anyhow, using this forum, i managed to create a chart in excel thru vb code. now i want to change few default settings of the chart.

1) i dont want the vertical lines in the chart.
2) the y scale must be in numeric format and the x scale must be in date format. but in the chart both the scales or shown in date format. how to set the format for both the scales?
3) is it possible to save the excel chart in TIFF or EPS format?

pls guide

regards,

prakash

Excel Chart
Hi, i'm trying to do one excel chart trough VB, but i'm not quite getting it. I did one macro and tried to modified her but with almost no result. Can you help me in this:

My macro:
///
With ObjXLApp

NM = .ActiveSheet.Name
N2 = Format(Date, "MMMM") & " " & Format(Date, "yyyy")

.Charts.Add
.ActiveChart.ChartType = xlLineMarkers
.ActiveChart.PlotBy = xlColumns
.ActiveChart.SeriesCollection.NewSeries
.ActiveChart.SeriesCollection(1).XValues = "={""Recolhas""}"
.ActiveChart.SeriesCollection(1).Values = "=NM" & !R2C4: RintNumerOfRows2C4 ""
.ActiveChart.SeriesCollection(1).Name = "=""Último minuto"""
.ActiveChart.SeriesCollection(2).Values = "NM!R2C5:RintNumerOfRows2C5"
.ActiveChart.SeriesCollection(2).Name = "=""Últimos 5 minutos"""
.ActiveChart.SeriesCollection(3).Values = "NM!R2C6:RintNumerOfRows2C6"
.ActiveChart.SeriesCollection(3).Name = "=""Últimos 15 minutos"""
.ActiveChart.Location Where:=xlLocationAsObject, Name:=NM
///

Excel Chart
hi all,

i am using excel object in my project. i managed to write in the data to the excel worksheet and save it. can any one tell me how to draw a chart in excel thru vb program?

pls guide. its urgent

regards,
prakash

Excel Chart
Hello,

1. Who can tell me where i can get the reference to use the vb 6.0 to control EXECL to chart.
2. If i want to show the EXCEL chart(may be very big) , how i can do?


thanks a lot.

Help With Chart In Excel
Hi, I created some code to open up a new Excel workbook that enters information and then creates a pie chart.. I can't quite remember how I put it together, but one part I have is to get letter of the last horizontal cell.. I used this line:

dim LastCell as String
LastCell = Chr(rsStats.RecordCount + Asc("A") - 1)

Then alittle more down, I select the data range:

oChart.SetSourceData Source:=oSheet.Range("A3:" & LastCell & "4"), PlotBy:=xlRows

This is, LastCell seems to work fine with A-Z, but I forgor the possibilty of going beyond Z (AA, AB, etc)..

Does anyone know how to get the name of the horizontal cell from Excel?
Thanks
John

Copyright © 2005-08 www.BigResource.com, All rights reserved