Author Topic: Automatic scaling of text  (Read 2474 times)

0 Members and 1 Guest are viewing this topic.

N1c0

  • Newbie
  • *
  • Posts: 2
Automatic scaling of text
« on: January 30, 2012, 09:01:33 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2973
    • Paul Herber's website
Re: Automatic scaling of text
« Reply #1 on: January 30, 2012, 09:13:30 AM »
You don't need to open the shapesheet window! The shapesheet editor is just for human use. Just remove that line.

« Last Edit: January 30, 2012, 09:15:06 AM by Paul Herber »
Electronic and Electrical engineering, business and software stencils and applications for Visio -

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

N1c0

  • Newbie
  • *
  • Posts: 2
Re: Automatic scaling of text
« Reply #2 on: January 30, 2012, 09:23:51 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2973
    • Paul Herber's website
Re: Automatic scaling of text
« Reply #3 on: January 30, 2012, 09:29:03 AM »
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.
« Last Edit: January 30, 2012, 11:22:16 AM by Paul Herber »
Electronic and Electrical engineering, business and software stencils and applications for Visio -

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