Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Simple recorded macro crashes on playback. Why?

I have a bar chart and a line chart on a sheet. One covers the other, so
that it appears that there is only one chart. I recorded a macro that sends
the visible chart to the back, exposing the hidden one.

Pretty simple, but when I play the macro back, it crashes with error
"Object doesn't support this property or method". Here is the macro:

Sub CHART_SHOW_BAR_CHART()
Range("A1").Select
ActiveSheet.ChartObjects("Chart 40").Activate 'the visible chart
ActiveChart.ChartArea.Select
Selection.ShapeRange.ZOrder msoSendToBack 'exposing the hidden chart
ActiveWindow.Visible = False
Windows("MSTATS.xls").Activate
Range("A1").Select
End Sub


Any help would be appreciated. If possible, is there a way to get rid of
the line " Windows("MSTATS.xls").Activate" because the workbook will have a
filename linked to the date.

TIA
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Simple recorded macro crashes on playback. Why?

Try

Sub CHART_SHOW_BAR_CHART()
Range("A1").Select
ActiveSheet.ChartObjects( _
"Chart 40").ShapeRange.ZOrder msoSendToBack 'exposing the hidden chart
End Sub


--
Regards,
Tom Ogilvy


"Paul" wrote in message
...
I have a bar chart and a line chart on a sheet. One covers the other,

so
that it appears that there is only one chart. I recorded a macro that

sends
the visible chart to the back, exposing the hidden one.

Pretty simple, but when I play the macro back, it crashes with error
"Object doesn't support this property or method". Here is the macro:

Sub CHART_SHOW_BAR_CHART()
Range("A1").Select
ActiveSheet.ChartObjects("Chart 40").Activate 'the visible chart
ActiveChart.ChartArea.Select
Selection.ShapeRange.ZOrder msoSendToBack 'exposing the hidden chart
ActiveWindow.Visible = False
Windows("MSTATS.xls").Activate
Range("A1").Select
End Sub


Any help would be appreciated. If possible, is there a way to get rid

of
the line " Windows("MSTATS.xls").Activate" because the workbook will have

a
filename linked to the date.

TIA
Paul



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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Recorded Macro want to know New Users to Excel 5 February 14th 07 12:46 PM
Creating a macro which presses a button containing a recorded macro petros89[_3_] Excel Programming 3 October 5th 05 02:49 PM
Recorded macro won't run rjamison Excel Programming 0 June 14th 05 12:14 AM
Simple code crashes Excel John[_60_] Excel Programming 1 October 27th 04 05:59 PM


All times are GMT +1. The time now is 05:53 PM.

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

About Us

"It's about Microsoft Excel"