+ Reply to Thread
Results 1 to 15 of 15

XML - RibbonX - Dropdown not working as expected

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    XML - RibbonX - Dropdown not working as expected

    i have added a dropdown menu item to an excel workbook. when i open the wb, i expect that my "Version Control" tab (which is does), expect the dropdown will show all of my open workbooks but that is not the case. it either shows just one workbook or the same workbook twice. what am i doing wrong?

    here is the xml

    Please Login or Register  to view this content.
    and here are the two procedures that get the data into the dropdown:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    Dropdowns work by loading the count in getItemCount, and then getItemLabel is called once for every instance of count where you load that item name, not all at once. Finally the selected index is set.

    Set a couple of public variables, wbSelected as a long, and wbNames as a variant.

    The ribbon code would then be

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    thanks bob, that worked perfectly. now i only have one question. how do i get the selected value for the dropdown. i tried putting a global variable in Function DropDown1_getSelectedItemIndex like so:

    Please Login or Register  to view this content.
    however the print statement does not print and the global var does not hold the value of the dropdown. what am i doing wrong?
    Last edited by dmcgov; 09-29-2020 at 11:21 AM.

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    I am afraid I keep getting an access error when I try to respond.

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    It must be something in the text of my answer because these posts are working fine.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    Maybe if I post in pieces ...




    You get it via the OnAction callback.

    You have already loaded a public variable wbNames with the array of workbook names, the OnAction callback passes your code the selected index, and you use this to index into the array.

  7. #7
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    XML
    Please Login or Register  to view this content.
    Code
    Please Login or Register  to view this content.
    (It's the LT symbols in the XML!)
    Last edited by Bob Phillips; 09-29-2020 at 12:35 PM.

  8. #8
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    so i made the change that you suggested and am getting an error on the print statement. it debugs to that line and when i position my cursor on lbound(wbNames), it says it's empty. let me post my code again to see if there is something amiss.

    Please Login or Register  to view this content.
    and here is the onAction statement:

    Please Login or Register  to view this content.
    and here is the XML

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    Have you declared wbNames as a public variable, and what module?

    Any chance of posting the workbook?

  10. #10
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    yes i declared it as public. in module mod_onAction. posting workbook now.
    Last edited by dmcgov; 09-30-2020 at 08:27 AM.

  11. #11
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    Sorry mate, my bad. I missed some brackets. It should be

    Please Login or Register  to view this content.

  12. #12
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: XML - RibbonX - Dropdown not working as expected

    Love the addin form, and intrigued by the whole workbook. I could probably spend some time and work out what it is all about, but could you summarise for me (PM if you want to keep it between us)?

    BTW, the 'Deploy Addin' button throws up a message, and mentions Purchsing, not Purchasing.

    Bit of humbly offered advice. When I build a ribbon I always give the controls functional names, I don't leave them as Button1, Button2, DropDown1 etc. I find it makes for easier maintenance going forward.

  13. #13
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    so did a few edits and now the error is back on the same line:

    Please Login or Register  to view this content.
    posting workbook again

    getting close to having this working
    Last edited by dmcgov; 09-30-2020 at 08:28 AM.

  14. #14
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    fixed issue, just had to close excel and open it back up. problem disappeared.

    here are the images for the animation, as mentioned, put them in your downloads folder.
    Attached Files Attached Files
    Last edited by dmcgov; 09-30-2020 at 10:07 AM.

  15. #15
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: XML - RibbonX - Dropdown not working as expected

    never heard back from you, what did you think of the app?

+ 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. SUM IF not working as expected
    By koalamotorsport in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-28-2019, 11:42 AM
  2. RibbonX Custom Dropdown Not Firing
    By delaing in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-20-2017, 03:04 PM
  3. [SOLVED] Formula in CF not working as expected
    By ImranBhatti in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-10-2017, 07:58 AM
  4. Sum Product not working as expected
    By hawaean in forum Excel General
    Replies: 2
    Last Post: 12-03-2016, 04:15 PM
  5. PowerPivot Not Working As Expected
    By EnigmaMatter in forum Excel General
    Replies: 1
    Last Post: 04-30-2015, 04:07 PM
  6. [SOLVED] Clearcontesnts not working as expected.
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2015, 07:16 AM
  7. Populate sheet names in RibbonX dynamic dropdown
    By 2Excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2011, 04:51 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