Wrox Programmer Forums
|
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2005, 12:38 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Application Defined Error in Excel VBA

Sub CreateChart2()
    Dim cntr As Integer
    Dim objChart As ChartObject
    Dim myChtRange As Range
    Dim ws As Worksheet
    Dim wb As Workbook
    Set wb = Workbooks.Open("c:\mahanti\graph.xls")

    Set ws = wb.Sheets(2)

    Dim left, top, width, height
    left = 100
    top = 40
    width = 340
    height = 250

    With ws

   For cntr = 1 To 7


    Set objChart = .ChartObjects.Add( _
      left:=left, top:=top, width:=width, height:=height)
     MsgBox "add"
    With objChart.Chart
    ws.Activate
      wb.Sheets(2).ChartObjects(cntr).Select


           .ChartArea.AutoScaleFont = False
        .ChartType = xlXYScatterLines




      ' Charts("Chart1").Activate



         MsgBox "activate"
      Dim i As Integer
 Dim x1 As Integer, y1 As Integer
 x1 = 2
 y1 = 4
 For i = 1 To 10

 MsgBox "infor"

.SeriesCollection.NewSeries


    MsgBox "series"
      .SeriesCollection(i).Name = "=Sheet1!R" & x1 & "C2"
       .SeriesCollection(i).XValues = Worksheets("Sheet1").Range("a" & x1 & ":a" & x1 + 2)
        MsgBox "x series"


.SeriesCollection(i).Values = Worksheets("Sheet1").Range(Chr(66 + cntr) & x1 & ":" & Chr(66 + cntr) & x1 + 2)
' while executin the above line I am geeting 400 error

        MsgBox "y series"

        x1 = x1 + 5
  Next i


         .HasTitle = True
        .ChartTitle.Characters.Text = "My Title"
        .ChartTitle.Font.Bold = True
        .ChartTitle.Font.Size = 12
        With .Axes(xlCategory, xlPrimary)
            .HasTitle = True
            With .AxisTitle
                .Characters.Text = "users"
                .Font.Size = 10
                .Font.Bold = True
            End With
        End With
        With .Axes(xlValue, xlPrimary)
            .HasTitle = True
            With .AxisTitle
                .Characters.Text = Worksheets("sheet1").Range(Chr(66 + cntr) & "1")
                .Font.Size = 10
                .Font.Bold = True
            End With
        End With
    End With
    top = top + 300
    Next cntr
  End With




End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
error when createobject excel.application vovo Classic ASP Professional 0 February 3rd, 2005 12:29 AM
Suspected Error in "Excel 2002 VBA" book rstober Excel VBA 7 September 2nd, 2004 05:48 PM
Application-defined error Ned Pro VB 6 0 December 11th, 2003 01:55 PM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.