Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 26

Thread: Toggle "select objects" instead of cells ??

  1. #1
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location

    Toggle "select objects" instead of cells ??

    I want to set Excel to "select shapes" instead of cells in the bar - I've tried this:

    Call CommandBars("Drawing").Controls("Select Objects").Execute

    but it wont compile at all !

    How is it done ?

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    Drop the Call.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    Yeah, yeah, ... error 91 Object not set !

    It's Excel 2016 Home365 version

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    All right - I'm only on Excel 2010 and it works fine here.
    Perhaps show more of your code.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    There is no more code ... I just want to secure the selection is on SHAPES in the first place.

    I place the line in Workbook_Open

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    Test the attached.
    If it errors or doesn't work, in the macro blah, try enabling all the commented-out lines It will try for 5 seconds before giving up.
    I'm guessing Excel hasn't fully loaded/isn't quite ready when the original Workbook_Open code was running.
    Attached Files Attached Files
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  7. #7
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    No Cure no pay !

    Nothing happens .... the "Select Objects" is NOT toggled ON

  8. #8
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    It is here!
    Is there any code running anywhere else - for example another event code?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  9. #9
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    No code running anywhere !

    I think we are talking past each other - right ?

    What I'm looking for is enabling the user to select SHAPES flowting on the worksheet by "lassoing" around them - normaly this will select a bunch of cells UNLESS you have toggled this "Select Objects" in the ribbon/bar !

  10. #10
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    Oh hold on, .Execute is a toggle command (it can switch the mode on AND off). Try the attached in the same way as msg#6.

    ps. yes I've understood this:
    Quote Originally Posted by ksor View Post
    What I'm looking for is enabling the user to select SHAPES flowting on the worksheet by "lassoing" around them - normaly this will select a bunch of cells UNLESS you have toggled this "Select Objects" in the ribbon/bar !
    Attached Files Attached Files
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  11. #11
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    It's simply NOT working

  12. #12
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    By the way, this is important: Supply links to everywhere you've cross posted this to. It's a rule here and at most other forums including MrExcel.
    Why? For your own benefit ultimately, have a careful read of http://www.excelguru.ca/content.php?184

  13. #13
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    Quote Originally Posted by ksor View Post
    It's simply NOT working
    I'm running out of ideas.
    Do you have access to Excel2010 somewhere so that you can test whether it's simply down to version differences?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  14. #14
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Try this instead:

    application.CommandBars.ExecuteMso "ObjectsSelect"
    Be as you wish to seem

  15. #15
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    Nice ... thx, it works nicely !

    Just inserted in the Workbook_Open sub !

  16. #16
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    Oh, not working !

    Next time I opened the file I got error

    Error.jpg


  17. #17
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    review msg#12

  18. #18
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    No solution there, I guess !

  19. #19
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    I guess you're doing this on purpose
    Quote Originally Posted by p45cal View Post
    Supply links to…

  20. #20
    VBAX Regular
    Joined
    Jan 2018
    Posts
    52
    Location
    ???????

    I don't get you !

Posting Permissions

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