Andy
Andy

Reputation: 25

Visio Set X and Y Coordinates

In Visio I am trying to change the shape's x and y coordinates. I am using the following code

VisioApp.ActiveWindow.Page.Shapes.Item(uniqueId).CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX).FormulaForceU = "18 in"
VisioApp.ActiveWindow.Page.Shapes.Item(uniqueId).CellsSRC(visSectionObject, visRowXFormOut, visXFormPinY).FormulaForceU = "-13.77 in"

but after running the code the shape's coordinate becomes (14.25, -34.27). The code changes the coordinates but doesnt give the intended result. Any idea on how to fix it ?

Upvotes: 2

Views: 2641

Answers (1)

Surrogate
Surrogate

Reputation: 1734

On my side your code works ! Try define shape variable

Dim sh As Shape Set sh = VisioApp.ActiveWindow.Page.Shapes.Item(UniqueID) sh.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX).FormulaForceU = "18 in" sh.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinY).FormulaForceU = "-13.77 in"

UPDATE Please open page's shapeshet and check Ruler & Grid section enter image description here If XRulerOrigin/YRulerOrigin is not equal 0 then you can see incorrect coordinates for shapes in window Size & Position

enter image description here

Upvotes: 1

Related Questions