Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 2002 Vs 2003

Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj



Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject

' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 2002 Vs 2003


It works for me in both versions.
Are some of the sheets protected in the xl2003 version?
What is the error?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel add-ins)



"Ardy"
wrote in message Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj

Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject

' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 2002 Vs 2003

On Jun 18, 12:09 pm, "Jim Cone" wrote:
It works for me in both versions.
Are some of the sheets protected in the xl2003 version?
What is the error?
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel add-ins)

"Ardy"
wrote in message Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj

Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject

' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------


Thanks for reply:
I don't have access to the 2003 version, It is my home version. I
will post the error as soon as I get home today. And yes there are
some protected sheet, but prior to deleting I am unlocking.......I
will post today with error.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 2002 Vs 2003

On Jun 18, 12:24 pm, "Don Guillett" wrote:
I just tested this in 2003. Should do it all

sub deleteallcharts()
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
end sub
--
Don Guillett
SalesAid Software
"Ardy" wrote in message

oups.com...

Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj


Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject


' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------


OK
I get the compile error, can't find project or library, I don't
understand why I don't get this with 2002 version. any thoughts.......



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 2002 Vs 2003

In the VBE, go to Tools References, and look for one that's labeled
"MISSING". Uncheck the reference and try again.

Very often things seemingly unrelated to a missing reference will fail.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Ardy" wrote in message
ups.com...
On Jun 18, 12:24 pm, "Don Guillett" wrote:
I just tested this in 2003. Should do it all

sub deleteallcharts()
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
end sub
--
Don Guillett
SalesAid Software
"Ardy" wrote in message

oups.com...

Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj


Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject


' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------


OK
I get the compile error, can't find project or library, I don't
understand why I don't get this with 2002 version. any thoughts.......



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 2002 Vs 2003

On Jun 19, 5:46 am, "Jon Peltier"
wrote:
In the VBE, go to Tools References, and look for one that's labeled
"MISSING". Uncheck the reference and try again.

Very often things seemingly unrelated to a missing reference will fail.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"Ardy" wrote in message

ups.com...

On Jun 18, 12:24 pm, "Don Guillett" wrote:
I just tested this in 2003. Should do it all


sub deleteallcharts()
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
end sub
--
Don Guillett
SalesAid Software
"Ardy" wrote in message


groups.com...


Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj


Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject


' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------


OK
I get the compile error, can't find project or library, I don't
understand why I don't get this with 2002 version. any thoughts.......


Thanks Jon:
I will try this tonight as soon as I get home, I hope this works. I
will post toinight if this worked.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 2002 Vs 2003

On Jun 19, 5:46 am, "Jon Peltier"
wrote:
In the VBE, go to Tools References, and look for one that's labeled
"MISSING". Uncheck the reference and try again.

Very often things seemingly unrelated to a missing reference will fail.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"Ardy" wrote in message

ups.com...

On Jun 18, 12:24 pm, "Don Guillett" wrote:
I just tested this in 2003. Should do it all


sub deleteallcharts()
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
end sub
--
Don Guillett
SalesAid Software
"Ardy" wrote in message


groups.com...


Hello All:
I have this code that is for deleting graphs(Charts). Can anybody
tell me why this works in 2002 but gives me error in 2003. for some
reason the 2003 has problem with chObj


Dim ch As Chart, ws As Worksheet
Dim cw As Long, rh As Long
Dim chObj As ChartObject


' ----------------Delete Existing Charts--------------------
Application.DisplayAlerts = False
For Each ch In ActiveWorkbook.Charts
ch.Delete
Next
For Each ws In ActiveWorkbook.Worksheets
For Each chObj In ws.ChartObjects
chObj.Delete
Next
Next
Application.DisplayAlerts = True
' ---------------Delete Existing Charts----------------------


OK
I get the compile error, can't find project or library, I don't
understand why I don't get this with 2002 version. any thoughts.......


Worked, Thanks a bunch. Can you explain what this option is
for..........

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems between 2002/2003 Brenda from Michigan Excel Discussion (Misc queries) 5 January 12th 09 08:47 PM
what's diferent in vba between 2002 & 2003 lasso Excel Programming 7 October 11th 06 03:04 PM
version 2002 Vs 2003 kikitinoq Excel Discussion (Misc queries) 0 July 31st 06 09:44 PM
VBA and 2002/2003/2000 Bill Sturdevant[_2_] Excel Programming 3 April 20th 05 03:24 PM
Outlook 2003 vs. Word 2002 LorrieWhite Charts and Charting in Excel 1 January 7th 05 03:45 AM


All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"