Announcement

Collapse
No announcement yet.

ActiveX Combo box tutorials

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ActiveX Combo box tutorials



    I'm wondering if there are any ActiveX combo box tutorials with a list of what the commands mean. I've googled things and seen the microsoft explination, but i was looking for more information than that.

    I've tried messing with these for a few days to get it to do what I want. I've posted to multiple boards with no response.

    for example, I went my backstyle to be transparent and I want it to remain transparent after I make a selection and move off of the combobox.

    I thought maybe the VBA lostfocus option would do that if i set the backstyle to transparent through that, but it hasn't worked.

    so, I've decide that maybe I don't really know what excel means when it says 'focus'.

    That amoung other questions.

    Any suggestions on where i can go? Thank you.

  • #2
    Re: ActiveX Combo box tutorials

    If the control is on a worksheet, then the transparency should only apply when the control does not have the focus and there is no way round that that I know of. (You can also just set it at design time).
    Rory
    Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

    Comment


    • #3
      Re: ActiveX Combo box tutorials

      Thanks for your response, Rory.

      However, I guess that's where I'm getting confused. What does it mean for the combobox to have 'focus'. I felt like it meant whenever the combo box was selected. So, I would go to the combobox, pick my selection and then move on. At that point, the combobox would turn transparent, leaving the selection, and it's all good in the hood.

      I feel like there should be a way to do it because if, for example, (1) I make a selection in the combo box, then I change the properties of the combobox to transparent, it goes to transparent with the selection. OR, (2) if I save the workbook, close and reopen, the combobox is transparent with the selection I saved it with.

      That being said, I was hoping there was a way, through VBA, to either change the backstyle to transparent, thereby reseting that property of the combobox, (1) above. OR, or refreshing the workbook as if it was saved, closed and reopened, (2) aboved.

      Any thoughts?

      Comment


      • #4
        Re: ActiveX Combo box tutorials

        Originally posted by freekrob View Post
        I felt like it meant whenever the combo box was selected. So, I would go to the combobox, pick my selection and then move on. At that point, the combobox would turn transparent, leaving the selection, and it's all good in the hood.
        That's how it should work and does for me. However ActiveX controls on worksheets are notoriously prone to odd behaviour.
        Which version of Excel are you using?
        Rory
        Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

        Comment


        • #5
          Re: ActiveX Combo box tutorials

          I'm currently using 2003. Let me explain my statement, slightly, as I was confused when I read my own quote and want to make sure I'm explaining clearly.

          ...I would go to the combobox, pick my selection and then move on (to another cell, or another combobox).

          At that point, the combobox would turn transparent, leaving the selection (it would maintain it's transparency after I moved on but leave the selection).

          ...

          Part of the reason the whole transparency thing matters is (1) for the look. The Combobox sits over a cell that has a bottom border, acting as a line to type on. Without the transparent nature, you can't see that line, or the type from the combo box looks ackward hanging over it. (2), I have some formulas in the cells under the combo boxes which use the vlookup function to auto fill if applicable.

          That's probably more info than you needed or wanted, but what you gonna do?

          Thanks for your help thus far!

          Comment


          • #6
            Re: ActiveX Combo box tutorials

            Just tested in 2003 and that is how it works there too. The combo is transparent while not selected.
            Rory
            Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

            Comment


            • #7
              Re: ActiveX Combo box tutorials

              Maybe I'm missing something then. Like I said, the combo box is transparent, with or without a selection from its list, when I open the file initially, or if I change something in the properties and the backstyle was set to transparent. Would you mind taking a look at my properties in the form of the attached image?
              Maybe something is wrong. The only items I change, other than size, are the ones marked with red dots.
              Click image for larger version

Name:	frkrb combobox.jpg
Views:	1
Size:	50.5 KB
ID:	1100231

              Additionally, the only code I currently have set for this combo box is:

              Code:
              Private Sub ModelNo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
               
                  If KeyCode = 9 Then
                  Range("Q9").Select
                  End If
               
              End Sub
              Thanks!

              Comment


              • #8
                Re: ActiveX Combo box tutorials

                Did I mention they were flaky? In my sample, my combo has started behaving the same as your even though I hadn't changed anything. Adding this seems to fix the transparency:
                Code:
                Private Sub ModelNo_LostFocus()
                   With ModelNo
                      .Enabled = False
                      .Enabled = True
                   End With
                End Sub
                Rory
                Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

                Comment


                • #9


                  Re: ActiveX Combo box tutorials

                  Ah rory, you save me again. Thank you very much as that fixes the whole issue. At least I learned alot about activex controls in the 3-4 days I used trying to get this thing to work. I want to cry now.

                  Thanks!!

                  Comment

                  Working...
                  X