+ Reply to Thread
Results 1 to 3 of 3

OnAction problem reading commandBarsComboBox value

  1. #1
    Registered User
    Join Date
    08-23-2006
    Posts
    4

    OnAction problem reading commandBarsComboBox value

    This one is driving me nuts. I can "read" all the properties of a commandbarComboBox EXCEPT the value within the box!

    Set NewBar = CommandBars.Add(Name:="RADAddin", temporary:=True)
    Set SrcCombo = NewBar.Controls.Add(msoControlComboBox, ID:=1, temporary:=True)
    Set BarLogin = NewBar.Controls.Add(msoControlComboBox, temporary:=True)
    Set BarPwd = NewBar.Controls.Add(msoControlComboBox, temporary:=True)
    Set LogInBtn = NewBar.Controls.Add(msoControlButton, temporary:=True)
    Set NewBarButton = NewBar.Controls.Add(msoControlButton, temporary:=True)

    With SrcCombo
    .Visible = True
    .Style = msoComboLabel
    .DropDownLines = 2
    .DropDownWidth = 60
    .AddItem "Production"
    .AddItem "QA"
    .Caption = "Select DataSource: "
    .TooltipText = "Select production or QA as source"
    End With
    With BarLogin
    .Visible = True
    .Style = msoComboLabel
    .DropDownLines = 0
    .Caption = "Camelot Login: "
    .TooltipText = "Enter Camelot Login ID"
    End With
    With BarPwd
    .Visible = True
    .Style = msoComboLabel
    .DropDownLines = 0
    .Caption = "Password: "
    .TooltipText = "Enter Camelot Login password"
    End With
    With LogInBtn
    .Visible = True
    .Style = msoButtonCaption
    .Caption = "Log In"
    .Width = 50
    .TooltipText = "Execute Login to Camelot"
    .OnAction = "DoLogin"
    End With
    With NewBarButton
    .Visible = True
    .Style = msoButtonCaption
    .Caption = "New Query"
    .TooltipText = "Open Form to Create new filtered Detail grid"
    .Enabled = False
    .OnAction = "ShowMenu"
    End With
    With NewBar
    ' Dock the toolbar at the top of the Microsoft Excel window.
    .Position = msoBarTop
    .RowIndex = LastRow
    ' Display the toolbar.
    .Visible = True
    End With


    When the user clicks the "Log In" button, the we want to execute code based on the entries within the comboBoxes. The "OnAction" property of the "Log In" button is stepping into the correct subroutine, but that's where I'm stumped.

    I've tried: commandBars("RadAddin").Controls("SrcCombo").text and .value...neither property exists.

    What am I doing wrong?

  2. #2
    Registered User
    Join Date
    08-16-2006
    Posts
    11

    Unhappy ComboBox Value

    I am having a similar trouble:

    At least you can get ahold of the comboBox list values my problem is that the control is ole type HTMLCONTROL and I can't seem to access any of the properties on it.

    Any help would be greatly aprecieated

  3. #3
    Registered User
    Join Date
    08-23-2006
    Posts
    4

    Find it first!

    This is certainly not intuitive, but it seems you have to "find" the control all over again!

    When creating the original CommandBarComboBox an .OnAction property was defined as well as a .Tag property. The code below is in the subroutine defined by the .OnAction property:


    Public Sub OnActionSubName()
    Dim cSrc As CommandBarComboBox
    Set cSrc = CommandBars("CommandBarName").FindControl(, , "TagName")
    x = cSrc.text
    end sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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