Try this in Excel (VBA gurus please)

  • Page

    of 1

    Previous Next
  • malloc 24 Aug 2012 18:34:51 2,844 posts
    Seen 3 hours ago
    Registered 14 years ago
    I'm getting an error in Excel 2003. To see if you get the same do the following:

    1. Create an autoshape in Excel, say an oval.
    2. Turn on the macro recorder.
    3. Click on the Oval to select it.
    4. Stop the macro recorder.
    5. Run that code.

    I get a run time error and have no idea of how to fix it. Anyone?
  • X201 24 Aug 2012 18:37:56 17,235 posts
    Seen 51 minutes ago
    Registered 10 years ago
    Haven't got Excel at home.

    Please call the help desk on Tuesday when normal service will be resumed
  • pauleyc 24 Aug 2012 18:56:16 4,548 posts
    Seen 3 hours ago
    Registered 14 years ago
    Strange, worked for me.

    Have a look at the code (Tools->Macro->Macros..., then highlight the one you created and select Edit). It should be similar to this:

    Sub Macro1()
    '
    ' blah
    '

    ActiveSheet.Shapes("Oval 1" ).Select
    End Sub

    Edited by pauleyc at 18:56:28 24-08-2012
  • malloc 24 Aug 2012 18:58:14 2,844 posts
    Seen 3 hours ago
    Registered 14 years ago
    Yeah, that's the code, but it doesn't work for me. I get:

    Run-time error '-2147024809 (80070057)'
    The item with the specified name wasn't found

    Stumped. Excel 2003?
  • malloc 24 Aug 2012 18:58:30 2,844 posts
    Seen 3 hours ago
    Registered 14 years ago
    Thanks for trying it and posting results btw.
  • pauleyc 24 Aug 2012 19:02:14 4,548 posts
    Seen 3 hours ago
    Registered 14 years ago
    Weird. Did you perhaps rename the autoshape? If you select it, does it say 'Oval 1' in the field left of the formula bar?
  • neilka 24 Aug 2012 19:08:20 18,017 posts
    Seen 4 minutes ago
    Registered 11 years ago
    Have you tried using a circle and making it narrower?
  • malloc 24 Aug 2012 19:15:24 2,844 posts
    Seen 3 hours ago
    Registered 14 years ago
    No renaming, the name is fine.
  • malloc 24 Aug 2012 19:17:27 2,844 posts
    Seen 3 hours ago
    Registered 14 years ago
    Tried it in Office 2010 and works fine. ARGH.
  • Page

    of 1

    Previous Next
Log in or register to reply

Sometimes posts may contain links to online retail stores. If you click on one and make a purchase we may receive a small commission. For more information, go here.