+ Reply to Thread
Results 1 to 2 of 2

Searching for Text in Shapes - VBA

  1. #1
    Registered User
    Join Date
    07-15-2016
    Location
    Denver, CO
    MS-Off Ver
    10
    Posts
    1

    Question Searching for Text in Shapes - VBA

    Hi everyone!
    I created an org chart in Excel, using rectangles and straight/elbow connectors. I want to include a search box that will allow users to input an employee's name and Excel will jump to/select the rectangle that contains the name.

    I'm just learning VBA, so I'm working with code that I find online and tweaking it to fit my needs. I've been pretty successful figuring out other issues, but this one has me stuck. The code I'm using (below), will occasionally work, but usually produces Run-time error '-2147024809 (80070057)': The specified value is out of range.

    When I debug, it highlights this line: sTemp = shp.TextFrame2.TextRange.Characters.Text
    HTML Code: 
    Any thoughts? Thanks in advance!!

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Searching for Text in Shapes - VBA

    The elbow connectors can't contain text. You could check for the shape's type or you could go Chuck Norris and put the following code at the start of your Sub

    On Error Resume Next

    Lemmings will die though.
    Frob first, tweak later

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Shapes, reading text into them
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2015, 11:05 AM
  2. Conditional Formatting For Text Inside Shapes
    By Louis.Shakespeare in forum Excel General
    Replies: 9
    Last Post: 09-29-2014, 07:46 AM
  3. Entering text on shapes
    By Russell Dawson in forum Word Formatting & General
    Replies: 4
    Last Post: 12-04-2013, 04:20 AM
  4. [SOLVED] followup top shapes as one colour, exclude 2 shapes
    By deancorleone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2013, 02:14 PM
  5. [SOLVED] Change color of text for a group of shapes
    By emiliekatherine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2012, 08:43 AM
  6. How To Move Shapes From Another Shapes? (floating shapes)
    By MarcLev in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2009, 04:04 PM
  7. locate shapes with specified text inside
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1