+ Reply to Thread
Results 1 to 15 of 15

Get Selected Object Name

  1. #1
    Registered User
    Join Date
    11-01-2023
    Location
    Germany
    MS-Off Ver
    365
    Posts
    2

    Question Get Selected Object Name

    Hello everyone,

    I'm currently working on a smaller project in VBA. To set up an "Edit" function I need to pass the name of a selected object. So far the output works great for the name of cells. But when I select my (grouped) shape there is no output. Although the name of the object is displayed in the small window at the top left. How could I solve this problem?

    To explain: The application is a project management tool. Operations planning takes place on a kind of Kanban chart. A form (grouped) is generated for each project and named with a unique continuous ID. If I now click on one of the Kanban cards I have to be able to pass the name of the object in order to set up an "edit" function. So that the form that opens knows which line it should pull its data from and where it should then write the changes. Right now it only outputs a "no object selected" message if i click a merged cell and the "Selected Object Name: " & selectedObjectName when I click on a cell. however not if i click on the kanban card.

    Here is the code. This will then be triggered later in the sheet using the function below when the selection is changed:
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 11-01-2023 at 09:47 PM. Reason: please use code tags

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Get Selected Object Name

    see big yellow banner - how to upload your workbook - far easier to then give specific solution.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    11-01-2023
    Location
    Germany
    MS-Off Ver
    365
    Posts
    2

    Re: Get Selected Object Name

    Quote Originally Posted by torachan View Post
    see big yellow banner - how to upload your workbook - far easier to then give specific solution.
    Wonderful exactly what I needed. I provided all necessary info and the code I am currently using. This is basic enough so you don't actually require the workbook. It's basically just looking for a function that will return the desired name. you don't need the workbook for this. Also I'm certainly not going to strip apart the workbook as instructed in the banner to remove all valuable data and make it small enough.

    How about not being the typical "meh you didn't follow the rules"guy but instead actually providing a solution? That would be truly wonderful thanks.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Get Selected Object Name


    Hello !

    Quote Originally Posted by niri2506 View Post
    To set up an "Edit" function I need to pass the name of a selected object.
    So weird and useless ! You very don't need to as the object is already selected …

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Get Selected Object Name

    Quote Originally Posted by Marc L View Post
    So weird and useless !
    Completely unnecessary comment. Please be constructive.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Get Selected Object Name

    Quote Originally Posted by niri2506 View Post
    Here is the code.


    Administrative Note:

    Welcome to the forum.

    We recommend that you 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 Guideline #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.

    I have done this for you.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,949

    Re: Get Selected Object Name

    @niri2506

    How about not being the typical "meh you didn't follow the rules"guy but instead actually providing a solution? That would be truly wonderful thanks.
    Two posts here and you are already criticising those offering to help you. If a member asks for a workbook, there is a reason for it. It has NOTHING to do with rules. If you want a solution, please comply with the request for a workbook.

    This is basic enough so you don't actually require the workbook.
    Not your call: YOU are the one asking for help. Your helper will decide what is and what is not necessary in order to assist you.

    Do not make rude and ungrateful comments like this to your helpers again. It will NOT be tolerated here. Thank you.

    Moderator
    Last edited by AliGW; 11-02-2023 at 03:01 AM. Reason: Typo fixed.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Get Selected Object Name


    Quote Originally Posted by 6StringJazzer View Post
    Completely unnecessary comment. Please be constructive.
    My constructive comment is passing the name is useless as the object is already selected so just work directly obviously with Selection

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,949

    Re: Get Selected Object Name

    It's your choice of vocabulary, Marc (I know English is not your first language). The word 'useless' carries a pejorative sense: you should use 'unnecessary' instead. 'Weird' would be better changed to 'strange'.

    As you wrote it, it was for from constructive to a native English-speaking person. I suggest you stop using the term 'useless' from now on.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,949

    Re: Get Selected Object Name

    Administrative Note:

    You really need to have a good read of our forum rules and guidelines!

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so. Cross-posts are allowed but you must provide a link to your posts on other sites.

    Please see Forum Rule #7 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. As you are new here, I shall do it for you this time: http://www.vbaexpress.com/forum/show...ed-Object-Name)

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Get Selected Object Name

    Thanks Ali !

    On my side both - useless vs unnecessary - are pretty the same (useless shorter to write), no pejorative will …
    Last edited by AliGW; 11-02-2023 at 07:23 AM. Reason: Please do NOT quote unnecessarily! Use the QUICK REPLY button instead.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,949

    Re: Get Selected Object Name

    But you are NOT a native English speaker - I am. If you suggested a change in my use of French, I would accept it as a non-native French speaker.

    Please do NOT use the word 'useless' again (this is an instruction, NOT a request).

  13. #13
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Get Selected Object Name


    As I did not wrote I do not accept your advise, I even thank you …
    I just explained both were in my mind pretty the same without any pejorative will, that's all !

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,949

    Re: Get Selected Object Name

    OK - thanks for clarifying.

  15. #15
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Get Selected Object Name

    Quote Originally Posted by Marc L View Post
    On my side both - useless vs unnecessary - are pretty the same (useless shorter to write), no pejorative will
    Let me offer another perspective.
    Rather than giving an evaluation of how bad you think a technique is, stick to facts. Instead of
    So weird and useless !
    you can say
    This can be done another way. Here is an example:
    That's the difference between critical and constructive.

+ 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. [SOLVED] Format selected object
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 12-17-2018, 03:57 PM
  2. [SOLVED] Keep object selected while performing another action/selection
    By AJB611 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-19-2017, 07:20 AM
  3. [SOLVED] Drawing object to change color when selected
    By colarguns in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-15-2014, 09:17 PM
  4. [SOLVED] How do I unselect an object once I have selected it in VBA?
    By redsab in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2013, 10:38 PM
  5. continue after object button has been selected
    By PeterYenroc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2011, 03:11 AM
  6. Excel 2007 : Move Object based on Selected Cell?
    By NewYears1978 in forum Excel General
    Replies: 4
    Last Post: 03-23-2010, 10:49 PM
  7. object selected on a chart
    By Anet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-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