Hello!
Im trying to make a program that adds calculated variables to the new Excel file:
Code:
Dim appxl
Dim Book As Excel.Workbooks
Dim Wsheet As Excel.Worksheet
FileName = "c:\temp\new.xls"
Set appxl = CreateObject("Excel.Application")
Set Book = appxl.Workbooks
Set Wsheet = Book.Add.Worksheets(1)
appxl.Visible = True
Wsheet.Cells(1, 1) = "Zudumi H[m]"
...
End Sub
It works fine, but I also want to build a chart using data that was inserted by my programm.
So I recorded a macro in Excel that does that:
Code:
Sub Auto_open()
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "='Ėčńņ1'!$C$1"
ActiveChart.SeriesCollection(1).XValues = "='Ėčńņ1'!$A$2:$E$2"
ActiveChart.SeriesCollection(1).Values = "='Ėčńņ1'!$A$3:$E$3"
Now Im only looking for a way how to add this macro to the same file that is created by the first code.. I would be gateful for any help