+ Reply to Thread
Results 1 to 2 of 2

Simple recorded macro crashes on playback. Why?

  1. #1
    Paul
    Guest

    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. #2
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1