×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Search Duplicate Text?

Search Duplicate Text?

Search Duplicate Text?

(OP)
Any idea can reach caption question?
 

RE: Search Duplicate Text?

I can probably help you with this, but I really need you to be MUCH more specific. Your question is to vague. Can you please provide more details?  

RE: Search Duplicate Text?

(OP)
hi Alcedes,
I do alot of word processing in Visio. e.g. Label the drawing unique items in hundred - computer name : samuel01 samuel02 ...samuel100

Some labels will be duplicated. e.g. samuel99 samuel99

So that need a way to find the duplicate text in visio to eliminate my typing fault

RE: Search Duplicate Text?

Sub ReLabel()

Dim ticker As Integer
Dim theshapes As Shapes
Dim counter As Integer
Dim reportback As String

    Set theshapes = ActivePage.Shapes

    Dim thisshape As Shape
    Dim shapenames As String
    Dim ReText(999999)

    For Each thisshape In theshapes
        ticker = ticker + 1
        ReText(ticker) = thisshape.Name
    Next

    For t = 1 To ticker
        counter = counter + 1
        CurName = Application.ActivePage.Shapes(ReText(t)).Name
    For x = 1 To ticker
     If Application.ActivePage.Shapes(ReText(x)).Name <> Application.ActivePage.Shapes(ReText(t)).Name Then
        
         
         If CurName = Application.ActivePage.Shapes(ReText(x)).Text Then
             reportback = reportback & Application.ActivePage.Shapes(ReText(x)).Name & vbCrLf
             ActiveWindow.Select Application.ActivePage.Shapes(ReText(x)), visSelect
             NewText = InputBox(Application.ActivePage.Shapes(ReText(x)) & " has a duplicate label. What would you like to change it to? ")
             Application.ActivePage.Shapes(ReText(x)).Text = NewText
         End If
     End If
    Next x
    Next t
  MsgBox "The following shapes have had their text changed:" & vbCrLf & reportback

End Sub


 

RE: Search Duplicate Text?

And of course, as always when running fresh code, save your document to another location using a different name. Run the code and be sure it works. This way, you do not hose your work.

RE: Search Duplicate Text?

(OP)
Hi Alcedes,

I copy and run it in visio macro.
But it seems dosn't work. Just appear "The following shapes have had their text changed"

Any idea? thx a lot.

RE: Search Duplicate Text?

Well this macro only runs on the current page. So you have to click on the page tab at the bottom of the screen that you wish to check.

 Also, if it returns a message box that claims nothing was changed, then basically, there were no shapes on the page that had text that matched another shapes text.

RE: Search Duplicate Text?

If you do not want to get into coding, you can use Visio's reporting feature and sort by name. You will still need to review the list for duplicates, but they should be easy to spot. (or you can extract the report to Excel)

John...   Visio MVP - Visio.MVPs.org

RE: Search Duplicate Text?

(OP)
Hi VisioMVP,
yes, this approach is good for me. you are excellent
Thank a lot!! smile

 

RE: Search Duplicate Text?

Yea...but where is the fun in avoiding code? ;)

RE: Search Duplicate Text?

One of the fun things with Visio is trying to do things WITHOUT coding. How far can you go with just using the shapesheet.

Sometimes it is like that scene from Indian Jones where after demonstrating his prowess with the whip, he just reaches for his revolver.

John...   Visio MVP - Visio.MVPs.org

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close