How can I put a shape in the upper left corner with VBA?

Started by WieSo_Zeigen, January 15, 2022, 09:06:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WieSo_Zeigen

Hallo everyone

How can I put a shape in the upper left corner with VBA?

I have the following VBA code:

Set shapeMaster = Application.Documents.item(Template).Masters.ItemU(ShapeObject)
Set ShapeTmp = Application.ActiveWindow.Page.Drop(shapeMaster, 0, 0)


With the last command, my shape is not where I expect it to be. >:(
What's wrong there?

Another question: Why did the zero point suddenly change?

See my srceen pictures

vielen Dank

Paul Herber

Newer versions of Visio (I can't remember when it was changed) default to having the page coordibates change to suit the locations of the shapes on the page.
You can turn this off - Page tab -> Page Setup -> Page Size
and select an actual page size (e.g. A4) rather than the default of "Let Visio expand the page as needed"
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Paul Herber

... and ... 0, 0 is lower left.
Top left coordinate is PageHeight - shape.centre
which is (as a formula)
=ThePage!PageHeight-LocPinY
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/