Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: N1c0 on January 30, 2012, 02:01:33 PM

Title: Automatic scaling of text
Post by: N1c0 on January 30, 2012, 02:01:33 PM
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
Title: Re: Automatic scaling of text
Post by: Paul Herber on January 30, 2012, 02:13:30 PM
You don't need to open the shapesheet window! The shapesheet editor is just for human use. Just remove that line.

Title: Re: Automatic scaling of text
Post by: N1c0 on January 30, 2012, 02:23:51 PM
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 ?
Title: Re: Automatic scaling of text
Post by: Paul Herber on January 30, 2012, 02:29:03 PM
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.