Jason said:
Hi all
I have some code to select shapes grap their top, left positions and then
move shapes to suit. When I run it through excel 2003 it works fine, however
excel 2007 doesn't position them correctly. Has there been any code changes
that I need to be aware of.
Any answers would be greatly appreciated
Yes some Shapes methods are screwed in XL2007 they gratuitously changed
the convention for specifying some of them from
BeginX, BeginY, XWidth, YWidth
to
BeginX, BeginY, EndX, EndY
Arguably you could say they did it to make the implementation match what
the XL2003 Help file says about eg AddConnector. In XL2007 AddShape
retains the old syntax of topleft, width, height whilst AddConnector
uses beginX, beginY, endX, endY so it is a right mess.
Not surprisingly all existing XL2003 code that uses affected shape
methods requires tedious rework and the codebase has to fork. It looks
particularly funny if some of your shapes have zero width or height.
AddConnector is badly affected whilst some other Shapes operations
remain unmolested if the Help is to be believed (you can't trust it in
any version). You basically have to test the Shapes functionality that
you use and put in work arounds.
Mostly mechanical alterations to parameter lists along the lines of
Bx, By, Wx, Wy becomes Bx, By, Bx+Wx, By+Wy (or vice versa)
A list of all the methods where the help is misleading and the
coordinates are not as described might be a useful resource. I only
tested the ones that were used in my software.
AddConnector changes caused me a lot of grief when XL2007 came out.
Regards,
Martin Brown