ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   chartobjects.activate fails (https://www.excelbanter.com/excel-programming/425032-chartobjects-activate-fails.html)

Scooter

chartobjects.activate fails
 
I have the following snipet in my code

Windows("abc.xls").Activate
Sheets("Profile").Select
ActiveSheet.ChartObjects(1).Activate

When I get to the 3rd line I get a "runtime error 1004". I have verified
that the sheet does contain a chart. I have used this in other workbooks
with no problem. What is wrong here?


Jacob Skaria

chartobjects.activate fails
 
Try replacing the index with chart name.

ActiveSheet.ChartObjects("ChartName").Activate

Jacob
----------
(If this post helps please hit Yes)



Scooter

chartobjects.activate fails
 
Same thing happens


"Jacob Skaria" wrote:

Try replacing the index with chart name.

ActiveSheet.ChartObjects("ChartName").Activate

Jacob
----------
(If this post helps please hit Yes)



Jon Peltier

chartobjects.activate fails
 
Is the sheet (or chart) protected? Is it the active sheet? Is the chart on a
sheet that's grouped with another sheet, or in a workbook that is shared?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Scooter" wrote in message
...
I have the following snipet in my code

Windows("abc.xls").Activate
Sheets("Profile").Select
ActiveSheet.ChartObjects(1).Activate

When I get to the 3rd line I get a "runtime error 1004". I have verified
that the sheet does contain a chart. I have used this in other workbooks
with no problem. What is wrong here?




Scooter

chartobjects.activate fails
 
The sheet is not protected. Yes the chart is on the active sheet. The sheet
is not part of a group or shared workbook. This is very strange to me since
I have used this code many times but for this one instance it does not work.

"Jon Peltier" wrote:

Is the sheet (or chart) protected? Is it the active sheet? Is the chart on a
sheet that's grouped with another sheet, or in a workbook that is shared?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Scooter" wrote in message
...
I have the following snipet in my code

Windows("abc.xls").Activate
Sheets("Profile").Select
ActiveSheet.ChartObjects(1).Activate

When I get to the 3rd line I get a "runtime error 1004". I have verified
that the sheet does contain a chart. I have used this in other workbooks
with no problem. What is wrong here?





Jon Peltier

chartobjects.activate fails
 
Could be a corrupted workbook, to use a trite excuse.

Do you realize that you don't need to do all the activating and selecting
just to modify something in the chart? If your next line of code is (for
example)

ActiveChart.HasTitle = True

you can achieve the same using

Workbooks("abc.xls").Worksheets("Profile").ChartOb jects(1).Chart.HasTitle
= True

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Scooter" wrote in message
...
The sheet is not protected. Yes the chart is on the active sheet. The
sheet
is not part of a group or shared workbook. This is very strange to me
since
I have used this code many times but for this one instance it does not
work.

"Jon Peltier" wrote:

Is the sheet (or chart) protected? Is it the active sheet? Is the chart
on a
sheet that's grouped with another sheet, or in a workbook that is shared?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Scooter" wrote in message
...
I have the following snipet in my code

Windows("abc.xls").Activate
Sheets("Profile").Select
ActiveSheet.ChartObjects(1).Activate

When I get to the 3rd line I get a "runtime error 1004". I have
verified
that the sheet does contain a chart. I have used this in other
workbooks
with no problem. What is wrong here?








All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com