+ Reply to Thread
Results 1 to 16 of 16

how to show tag based on another commandbutton

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    how to show tag based on another commandbutton

    Hello
    I want to show tag of a userform control through mouseover event but with the condtion that if I have clicked a commandbutton.Like my commandbutton is captioned as "What is this?",
    I want to click the command button first then if I hoverover the mouse to any control it should display the tag of respective usrform control.

    Thoughts?

    Best Regards
    Imran Bhatti
    Teach me Excel VBA

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: how to show tag based on another commandbutton

    Use the ControlTipText property. Text in this property is displayed when the mouse is over a control. VBA does not implement the Whatsthis help feature very well

  3. #3
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    Hi,
    If you want to show ControlTipText only after you have pressed button:
    Create some global variable:
    Please Login or Register  to view this content.
    Then on userform intialization:
    Please Login or Register  to view this content.
    For button:
    Please Login or Register  to view this content.
    And MouseMove event for button:
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    Problem with controltooltiptext is that it does not support multiline it goes longway with single line.

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: how to show tag based on another commandbutton

    So how did you intend to display the contents of the TAG property then?

    And if you specifically wanted multi-line text you never mentioned that in your first post... so how is anybody to know? What else do you want/not want from this?

  6. #6
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    How about this trick with Label. Create Label and show it on MouseMove event.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    Trick is good.But problem is when there are many controls on the userform .the help label goes behind them .If it is always shown above the controls then this trick is really really awsome.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    Add this code to MouseMove code
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    Variable not defined error and selects (fmtop)

  10. #10
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    Hm, worked on my machine, try this one
    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    error removed but no effects. still behind the controls.

  12. #12
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    Am I missing a reference ?

  13. #13
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    Try to add reference "Microsoft Forms 2.0 Object Library"

  14. #14
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    I am using Excel 2016 and just checked and the said reference is ticked already. But still no effects.

  15. #15
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: how to show tag based on another commandbutton

    I give up, it's working on my Office 2010

  16. #16
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: how to show tag based on another commandbutton

    Hi Kasan

    I put that label inside a frame and added the same lines of code for it.The good thing about the frame is that is is alwasy shown on top of other controls.

    I modified your code accordingly and it worked.Thanks for all your help.And have a star from me.


    Best Regards
    Imran Bhatti

+ 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] VBA to populate CommandButton caption based on value in cell
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2016, 05:25 AM
  2. Show value CommandButton in a Label
    By smjjvh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2014, 12:59 PM
  3. [SOLVED] Show ListBox based on CommandButton
    By WimpieOosthuizen in forum Excel General
    Replies: 5
    Last Post: 06-17-2014, 08:46 AM
  4. Commandbutton in userform to execute code based on a previous commandbutton choice?
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2012, 03:28 PM
  5. Have CommandButton show for specific user
    By penny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2010, 01:08 PM
  6. How to make a commandbutton show in all sheets?
    By Bluewhistler in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-14-2010, 11:14 AM
  7. Hide commandbutton based on NT username
    By PRodgers4284 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2009, 04:31 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