Automatic scaling of text

Started by N1c0, January 30, 2012, 02:01:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

N1c0

Hi!

I have tens of visio shapes that I want to scale with 0.2 (text and arrows)
I can do the scaling in the shapesheet but only for one shape....

I tried to record a macro doing this, but it always throws an exception when it comes to opening the shapesheet:


Sub scale02()
' Tastenkombination: Strg+w
'

    Application.ActiveWindow.Page.Selection.OpenSheetWindow

    Shape.CellsSRC(visSectionObject, visRowXFormOut, visXFormWidth).FormulaU = 0.048

    Application.ActiveWindow.Shape.CellsSRC(visSectionObject, visRowXFormOut, visXFormHeight).FormulaU = 0.0309

    Application.ActiveWindow.Shape.CellsSRC(visSectionObject, visRowLine, visLineArrowSize).FormulaU = 2 * 0.2


End Sub

Thanks bunches,
Nico

Paul Herber

#1
You don't need to open the shapesheet window! The shapesheet editor is just for human use. Just remove that line.

Electronic and Electrical engineering, business and software stencils for Visio -

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

N1c0

Thanks a lot for answering so fast!
Unfortunately it doesn't work like this and i am not to much into vba with visio.

It throws the exception "object is necessary" or "exception occured" (I don't use visio in english, so I translated the messages).

Anyway, how can I refer to all shapes in the sheet? Why doesn't this work with ctrl+A ?

Paul Herber

#3
You can only do one shape at a time, your code needs to loop through all the shapes on a page and get a shape reference. There are many examples here on the Visio Guy forum of such code in VBA.
Electronic and Electrical engineering, business and software stencils for Visio -

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