ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why won't this Excel 2000 code work for Excel '97? (https://www.excelbanter.com/excel-programming/275178-why-wont-excel-2000-code-work-excel-97-a.html)

Andrea[_2_]

Why won't this Excel 2000 code work for Excel '97?
 
I am developing in Excel 2000 for an application that
will be run in Excel '97 (and then eventually 2000).
This workbook has a sheet with 3 embedded charts on it.
The data source for the charts is external to this
workbook.

This workbook also has a worksheet which is divided into
4 quadrants of data. One of these quadrants is displays
one of the 3 embedded charts. The user can alternate
showing any of the 3 charts in this quadrant by just
selecting an option button. The option button runs the
code segment below.

(BTW, this is a brute force method - as it is copied from
a macro recording. Tried to clean it up by removing lines
like:
Windows(ThisWorkbook.Name).Activate
Actually, I guess my first question 1 is, why doesn't
Excel 2000 like this line removed from the code segment
below? I only have one workbook open)

Question 2: When I open this workbook in Excel '97, all
works fine EXCEPT the last line of code in the segment
below. It fails on
Windows(ThisWorkbook.Name).Activate
Any ideas why?
-------------------------

Application.ScreenUpdating = False
ActiveSheet.ChartObjects("theChart").Delete
ActiveSheet.Shapes("Legend").Delete
Sheets("Sheet1").Select
ActiveSheet.ChartObjects("Counts").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
Windows(ThisWorkbook.Name).Activate
Sheets("Quad Chart").Select
ActiveSheet.Paste
ActiveSheet.ChartObjects(1).Activate
ActiveSheet.ChartObjects(1).Name = "theChart"
theTop = ActiveSheet.Shapes("theChart").Top
theLeft = ActiveSheet.Shapes("theChart").Left
ActiveSheet.Shapes("theChart").IncrementTop -(theTop)
ActiveSheet.Shapes("theChart").IncrementLeft -
(theLeft)
ActiveSheet.Shapes("theChart").IncrementLeft 130
ActiveSheet.Shapes("theChart").IncrementTop
ActiveSheet.Shapes("lblProgramHealth").Top + 15
ActiveWindow.Visible = False
Windows(ThisWorkbook.Name).Activate




All times are GMT +1. The time now is 02:57 PM.

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