Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2004
    Location
    chennai, Inverness-shire, India
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel Graph from Access (Access 2000)

    Hi,
    I tried to create an Excel graph from Access using my query and I am getting a error saying "Method 'Range' of Object _Global failed. When I closed my access db and reopened it again I get another error message saying " The text you entered is not a valid reference or defined name". Here is the part of the code that is giving me the error.

    Set rng = .Selection
    ' add a chart object
    .ActiveSheet.ChartObjects.Add(135.75, 14.25, 607.75, 301).Select
    'run the chart wizard
    .ActiveChart.ChartWizard Source:=Range(rng.Address), _
    Gallery:=xlColumn, Format:=6, PlotBy:=xlColumns, CategoryLabels:=1, _
    SeriesLabels:=1, HasLegend:=1, Title:="Number of people in locations", _
    CategoryTitle:="", ValueTitle:="", ExtraTitle:=""

    Any help would be appreciated.

    Guna

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Graph from Access (Access 2000)

    Your code apparently is part of a With ... End With block, but you haven't posted that. It should refer to an Excel.Application object that has been initialized properly. If selected range contains valid information, the code should work, but you haven't told us what the selected range is.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Excel Graph from Access (Access 2000)

    Hi,
    Does it help if you change
    Source:=Range(rng.Address)
    to read
    Source:=rng
    in your code? I suspect your issue is that you are not qualifying Range - e.g. as .Activesheet.Range
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •