jdsell has asked for the wisdom of the Perl Monks concerning the following question:

I've written a small perl program that draws objects on a Visio document. The program works well for what it does, selecting objects off stencils and dropping the shape in the correct location in the drawing. Where I'm hung up is in my attempt to resize the shape once I've "dropped" it. No amount of research or google searching has pointed me in the right direction, I was hoping for a "setWidth" method off the Shape Object but nothing so simple pops up in the MS Visio Automation documentation. I'm running Visio 2003 and would really like to figure this out....

Replies are listed 'Best First'.
Re: Help with Shapes in Visio - via OLE
by aquarium (Curate) on Nov 16, 2007 at 23:49 UTC
    my memory of this stuff is a bit hazy....could you set the width using the "Object properties" dialog?...which can be accessed with right click or using menu.
    the hardest line to type correctly is: stty erase ^H
      Thanks Aquarium, A little more digging shows how to do it....

      .......
      my $shapeObj = $visioPage->Drop($stencilObj, $dropX, $drop);
      $shapeObj->{'Text'} = $shapeName;

      my $shpWidthObj = $shapeObj->Cells('Width');
      my $shpHeightObj = $shapeObj->Cells('Height');

      $shpWidthObj->{'Formula'} = $WIDTH;
      $shpHeightObj->{'Formula'} = $HEIGHT;
      ........

      I just typed this in from memory - have to run to the store. I'll post a fuller example (with descriptions) for future generations... <lol>
        Can you post your final program, jdsell? I am interested in how you were able to perform the Drop mostly, as I have been having trouble finding the correct syntax for it. What do $stencilObj, $dropX, and $drop equal? This is what I have. I am trying to drop a connector.
        $stencilobj = $Visio->ConnectorToolDataObject; $vsoConnectorShape = $Visio->ActiveWindow->Page->Drop($stencilobj, 2, +2);
        Thanks! Joe