954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

generating excel chart in VBA

greetings..

i'm suppose to make a programme that reads a notepad file generated by other programme interfacing with an device which tests components, and then generates a graph of it in Excel.. so far i've succeeded in reading from the notepad file and making a spreadsheet in excel, but not able to generate a chart in any way.. the most i get to is to generate the box where the chart is to be in..
i used some of the examples found (googled them out) but none of them works

these are some of the declarations i made

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSht As Excel.Worksheet
Dim xlRng As Excel.Range
Dim xlChart As Excel.Chart
Dim GeneratedChart As Excel.ChartObject


and here's the part that i use to generate my chart

Set GeneratedChart = ActiveSheet.ChartObjects.Add _
        (Left:=100, Width:=375, Top:=300, Height:=225)
    GeneratedChart.Chart.SetSourceData Source:=Sheets("Sheet1").Range("K3:K41")
    GeneratedChart.Chart.ChartType = xlXYScatterLines
End Sub


i also tried using recorded macro in excel when generating a chart, and copy paste it into my code but that doesnt work either..

i'd be glad if someone can help me out in this part..thanks in advance
-osman-

BombAppetit
Light Poster
29 posts since Jun 2006
Reputation Points: 16
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You