Nurilhansiz 0 Newbie Poster

hi again.. i have a problem with excel.. tried to print a chart using excel nia vb but it doesnt work and when it does, it keep producing charts tat are infinity..ALOT OF chart without stopping! HELP!!

Private Sub cmdExcel_Click()
'
'
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
'Dim xlColumn As Axis
'Dim xlLocationAsObject As Axis


Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add

With xlApp
.Visible = True

' Macro recorded 11/14/2006 by CrashOverride

.Range("A2").Select
.ActiveSheet.Paste
.Range("B2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=0
.Range("C2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=-3
.Range("A3:A9").Select
.ActiveWindow.SmallScroll Down:=-9
.Range("A1:C36").Select
.ActiveWindow.SmallScroll Down:=3
.Range("B35").Select
.ActiveCell.FormulaR1C1 = "12.94"
.Range("A1:C36").Select
.Range("C36").Activate
.Charts.Add
.ActiveChart.ChartType = xlLine
.ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C36"), PlotBy _
:=xlColumns
.ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Assembly Mistakes"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "No of ribs"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Tolerance"
End With
.ActiveSheet.Shapes("Chart 1").ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
.ActiveChart.Legend.Select
.Selection.Position = xlBottom
.ActiveChart.Axes(xlValue).Select
.Windows("Book2").SmallScroll Down:=-3
End With

End Sub