Visio 2003 icon word wrap

billwharton
billwharton used Ask the Experts™
on
Visio 2003

When I try to name a Cisco or other icon, the number of characters I can fit in a single line is limited. I want to fit in at least 20 characters in a single line without it automatically going to the next line and still use a font size of 10. I know how to do this with a new text block that can be placed below the icon but I rather do this naming the icon like a switch or router itself. Right clicking on the icon -> format -> text doesn't have any options for 'word wrap'
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Using the text block tool (accessible from the drop down beside the text tool) you can resize the textbox, making it longer will allow you to enter more text with out it automatically wrapping

Jon Estey

Author

Commented:
Well, my original question did state that I am not looking for the text block tool hence there wasn't really anything helpful int he expert's comment.

riteheer, you decide...

Commented:
billwharton,

You said "I know how to do this with a new text block ", what I instructed didnt use a "new" text block but rather modified the text block that was already there using the "new text block" tool.

Jon
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Author

Commented:
Isn't resizing the same thing Jon whether I modify a current text block or create a new text block and modify it? The point here is that I did know how to do that and stated it appropriately in my original question.

My original query asked to avoid word wrap when naming an icon directly (without using any text block at all) and that's still unanswered

Commented:
billwharton, Well no.. you didnt mention that you didnt want to resize it in your original question, and  I have no way of knowing your skill level/knowledge of visio so I gave you the simplest solution to your problem

There is no way to avoid word wrapping when "naming an icon directly" without either modifying the icon itself and resizing its text block there or using VBA and making a small script that resizes the text block for an object whenever it is added to a sheet

this is assuming that by "naming an icon directly" you mean clicking on the icon and typing text.

It would also be possible to create a small VBA script that simply resizes all text blocks so that no word wraping occurs.

Jon Estey

Author

Commented:
Thanks Jon

That small VBA script would be the answer I'm looking for
Commented:
bill,

the following works well to estimate the length required, it doesnt take into account multiple lines of text, but should work for any centered text

Function MasterTest(ByVal Shape As IVShape)
    On Error GoTo ErrExit
   
    Dim sTemp As String
    sTemp = Shape.Master.Name
    MasterTest = True
   
    Exit Function
   
ErrExit:
    MasterTest = False
End Function

Private Sub Document_ShapeExitedTextEdit(ByVal Shape As IVShape)
    If (Shape.Type = 2 Or Shape.Type = 3) And MasterTest(Shape) Then
        Shape.Cells("TxtWidth") = Shape.Section(visSectionCharacter)(0)("Char.Size") * Len(Shape.Text) * 0.8
    End If
End Sub

to use for all text remove the "And MasterTest(Shape) " portion and it will check regular text boxes as well as shape text

Jon

Author

Commented:
Should I simply copy and paste the data between Function & End Sub and put it in a text file, name it with a .vbs extension and run it? How do I make this work/

thx Jon

Commented:
In visio, show the developer toolbar, click on visual basics editor, double click on "this document" in the projects pane, then paste the above code into the file

Jon

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial