Resize shape(s) with text

J

Joe

I am using Visio 2002 and want to resize the shapes that I drop on a page (via VBA) so that their associated text appers nicely. The text is formatted as

sometext & vbcrlf & somemoretext & vbcrlf & somemoretext & vbcrlf & finaltext

I need to do this for two cases:

1) the shape is not associated with a group

and

2) the shape is associated with a group and consists of a bitmap grouped with a textbox.

Since I am new to Visio automation, would someone please be willing to lend me a hand with this?

TIA,
 
M

Mark Nelson [MS]

Typically you would do this by putting a formula in the shape that governs
the size of the text block. You do not need VBA to do this unless you are
not designing the shape yourself. The basic formula to assign to the
TxtWidth cell is:

=TEXTWIDTH(TheText)

If you want to set that through VBA, try this:

ShapeObject.CellsU("TxtWidth").Formula = "=TEXTWIDTH(TheText)"

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Joe said:
I am using Visio 2002 and want to resize the shapes that I drop on a page
(via VBA) so that their associated text appers nicely. The text is
formatted as
 
M

Mark Nelson [MS]

Look in the Format > Behavior dialog at the group settings. You can specify
whether the group appears in front of its member shapes or behind. This
controls the DisplayMode cell in the Shapesheet.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Joe said:
Thanks Mark. This works fine. And you're right. I didn't create the
shapes and can't really change them easily, so VBA is my only route to do
this.
Now I have another issue. When the textbox shape of the textbox-bitmap
group resizes, some of the text appears behind the bitmap. Is there a way
for me to deal with this? Is is possible (with VBA) to break the group,
position the textbox below the bitmap and then recreate the group?
Thanks for all of your help.
--
Joe

VBA Automation/VB/C++/Web and DB development
 
J

Joe

Mark,

This still doesn't quite do it. I can't have any text over the bitmap. Is it possible to reposition the textbox relative to the bitmap?

Thanks,
--
Joe

VBA Automation/VB/C++/Web and DB development
 
M

Mark Nelson [MS]

Text is controlled by the text box. If you go to the Text Transform section
in the Shapesheet, you can modify the text box. TxtPinX and TxtPinY
position the box. TxtWidth and TxtHeight size the box.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Joe said:
Mark,

This still doesn't quite do it. I can't have any text over the bitmap.
Is it possible to reposition the textbox relative to the bitmap?
 
J

John Marshall, MVP

Do NOT break the group. The new text block can be added to the original
group.

John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
Joe said:
Thanks Mark. This works fine. And you're right. I didn't create the
shapes and can't really change them easily, so VBA is my only route to do
this.
Now I have another issue. When the textbox shape of the textbox-bitmap
group resizes, some of the text appears behind the bitmap. Is there a way
for me to deal with this? Is is possible (with VBA) to break the group,
position the textbox below the bitmap and then recreate the group?
Thanks for all of your help.
--
Joe

VBA Automation/VB/C++/Web and DB development
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top