Results 1 to 7 of 7

Thread: A VBA Question (Tooltip)

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    57

    Question A VBA Question (Tooltip)

    Hi

    How can I add Tool tip text to a text box which I have added to my Excel sheet?

    Thnx in advance.

    Regards
    a_k93
    when u get an error, means u r code getting executed

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: A VBA Question (Tooltip)

    Moved to Office Development

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: A VBA Question (Tooltip)

    No easy way but you would want to use the MouseMove event to determine when the mouse is over the textbox.

    I know there are a few good tooltip examples in the CodeBank but I have never tried using them on an Excel ccontrol.

    Which textbox is it? A Forms or ActiveX Textbox?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    57

    Re: A VBA Question (Tooltip)

    Hi there,

    Thnx for your reply,

    I am newbie for excel VBA. I have right click on the toolbar and selected Control Toolbox. which then gave me n nos of control. Then I have dragged and drop the controls on the excel sheet.

    Can I ask u more thing.
    I have around 100 textboxes and 15 combo box and 5 check box on a sheet and around 125 labels and likewise I have 5 sheets. Now I am on particular sheet I want to clear all the textboxes from that sheet.
    Like in VB6 v write
    Dim ctrl As Object
    For Each ctrl In Me.Controls
    Debug.Print ctrl.Name
    Next
    How do I do the same for Excel controls which I have in my all sheets.

    Once again, thnx for your reply,

    Regards,
    a_k93
    when u get an error, means u r code getting executed

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: A VBA Question (Tooltip)

    Check out the InlineShapes or OLEObjects collections.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    57

    Re: A VBA Question (Tooltip)

    Hi there,

    Thanx for u r help Rob.

    I was looking for the code which will set the properties of all the controls placed on the sheet.
    The code below does the same.
    I have written the generic method in the module

    Public Sub Clear_ctrl(strShetName As String)
    Dim objWs
    Dim objShape
    Set objWs = Worksheets(strShetName)
    For Each objShape In objWs.Shapes
    If objShape.Type = msoOLEControlObject Then
    If objShape.OLEFormat.ProgId = "Forms.CheckBox.1" Then
    objWs.OLEObjects(objShape.Name).Object.Value = 0
    End If
    If objShape.OLEFormat.ProgId = "Forms.TextBox.1" Then
    objWs.OLEObjects(objShape.Name).Object.Text = ""
    End If
    If objShape.OLEFormat.ProgId = "Forms.ComboBox.1" Then
    objWs.OLEObjects(objShape.Name).Object.Text = ""
    End If
    If objShape.OLEFormat.ProgId = "Forms.OptionButton.1" Then
    objWs.OLEObjects(objShape.Name).Object.Value = 1
    End If

    End If
    Next

    End Sub


    Thanx for u r support.

    Rob, can u elaborate little bit more on the Tooltip point, like how should I go about when I move the mouse over any textbox which needs to show the tooltip, do I need to call any api or anything like ....

    Thanx
    a_k93
    when u get an error, means u r code getting executed

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: A VBA Question (Tooltip)

    Use the MouseMove event for each of the controls. It fires when the mouse moves over the control.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width