开发者

VBA Excel 2007 macro dies in Excel 2002

I have just tried to send a workbook to a friend that has a chart with a drop-down b开发者_如何转开发ox on it. In excel 2007 I have used:

If Chart2.Shapes(2).ControlFormat.ListCount = "16" Then

To check the size of the list so that it doesnt get entered in again (resulting in an extremely long list that repeats itself). This line works well in Excel 2007, but gives a Object doesn't support this property or method. error in Excel 2002.

What is the difference between working with shapes in 2002 vs 2007?


Ok, it ended up being something simple that took me ages to pick up on.

Excel 2007 counts shapes differently to 2002. The shape I was trying to reference in 2007 (2) was now (1) in 2002.

So, the final result was of course

If Chart2.Shapes(1).ControlFormat.ListCount = "16" Then


The difference is you don't get to use the shiny new methods and collections introduced over the years. Unfortunately MSDN isn't going to be much help to you in this area. Your best bet is to somehow pick up the appropriate help file and read the documentation for the version you want. You can find all the 2002 help files here.

The problem you are facing is that the ListCount property is read only in 2002.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜