+ Reply to Thread
Results 1 to 3 of 3

Error - To select a shape its view must be active

  1. #1
    Registered User
    Join Date
    11-15-2021
    Location
    London
    MS-Off Ver
    10
    Posts
    3

    Error - To select a shape its view must be active

    Hello everyone

    I wrote a code to reposition images in the PPT slide by selecting from a list.
    To select from a list I use Combo box.
    The problem is that I get the error after I select from the list.

    I would appreciate if anyone could help me.

    Below is the code:


    Private Sub ComboBox1_Change()

    ComboBox1.List = Array("Increase", "Reduction", "No change", "Empty")

    ComboBox1.ListRows = 4

    If ComboBox1.Value = "Reduction" Then

    ActivePresentation.Slides(1).Shapes.Range(Array("Wshape")).Select
    Selection.ShapeRange.ZOrder msoBringToFront


    ActivePresentation.Slides(1).Shapes.Range(Array("neutral")).Select
    Selection.ShapeRange.ZOrder msoBringToFront

    End If

    If ComboBox1.Value = "Empty" Then

    ActivePresentation.Slides(1).Shapes.Range(Array("Wshape")).Select
    Selection.ShapeRange.ZOrder msoBringToFront


    ActivePresentation.Slides(1).Shapes.Range(Array("Wshape")).Select
    Selection.ShapeRange.ZOrder msoBringToFront

    End If

    If ComboBox1.Value = "No change" Then

    ActivePresentation.Slides(1).Shapes.Range(Array("Wshape")).Select
    Selection.ShapeRange.ZOrder msoBringToFront


    ActivePresentation.Slides(1).Shapes.Range(Array("MEDIUM")).Select
    Selection.ShapeRange.ZOrder msoBringToFront

    End If

    If ComboBox1 = "Increase" Then

    ActivePresentation.Slides(1).Shapes.Range(Array("Wshape")).Select
    Selection.ShapeRange.ZOrder msoBringToFront


    ActivePresentation.Slides(1).Shapes.Range(Array("HIGH")).Select
    Selection.ShapeRange.ZOrder msoBringToFront

    End If

    End Sub

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Error - To select a shape its view must be active

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

    You do not need to select it. And if it is a single shape no need for shaperange. Just use the Shapes collection.
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-12-2022
    Location
    new york
    MS-Off Ver
    50005
    Posts
    1

    Re: Error - To select a shape its view must be active

    i just tried thise method it's 100% work.
    thank you

+ 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. Replies: 0
    Last Post: 10-01-2020, 05:40 AM
  2. Select shape in active cell
    By Papa Newch in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2014, 05:09 PM
  3. [SOLVED] A macro after setting onaction for a shape that will select the shape.
    By vonRobbo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2014, 11:34 PM
  4. Select a shape based on a cell value and update the shape when value changes
    By BigAl99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2013, 12:06 PM
  5. Error message - Method 'Select' of object 'Shape' failed
    By cdchi1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2007, 03:00 AM
  6. [SOLVED] Run-Time Error: You must select a shape
    By Lee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-25-2005, 02:06 PM

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