Results 1 to 4 of 4

Excel CustomUI Ribbon - Retrieve Variable Value from another Sub ()

Threaded View

Mota Excel CustomUI Ribbon -... 08-11-2017, 04:07 PM
alansidman Re: Excel CustomUI Ribbon -... 08-11-2017, 04:35 PM
xlnitwit Re: Excel CustomUI Ribbon -... 08-12-2017, 02:35 AM
Mota Re: Excel CustomUI Ribbon -... 08-15-2017, 09:48 PM
  1. #1
    Registered User
    Join Date
    09-22-2009
    Location
    Yep
    MS-Off Ver
    Excel 365 Pro Plus
    Posts
    34

    Excel CustomUI Ribbon - Retrieve Variable Value from another Sub ()

    Hi There
    I have a macro that use a CustomUI Ribbon with dynamic Dropdown menu (see described below).
    Based on selection, the user should click in a button and run another macro that would open another workbook.

    The value from the dropdown is captured by "returnedVal1" but when I try to use it from Sub Details (), I failed. Value is blank ("")
    Could you please help me and provide the right directions to fix it?
    Another issue is: Is there a way to refresh my CustomUI Ribbon automatically every time I open the file?

    Hope to be hearing from you soon
    Thanks and regards


    Private Sub itemCount(control As IRibbonControl, ByRef returnedVal1)
        Call DropDown1
        returnedVal1 = iItemcount5
    End Sub
    Private Sub getItemLabel3(control As IRibbonControl, index As Integer, ByRef returnedVal1)
        returnedVal1 = vRngValues(index)
    End Sub
    Macro 3)
    Private Sub Details(control As IRibbonControl)
    Dim wsSheet As Worksheet
    Dim sFile$
    
    Set ws1 = ActiveWorkbook.Sheets("Summary")
    
    On Error Resume Next
    
    If returnedVal1 = "File1_Name" Then
        sFile = ActiveWorkbook.Path & "\" & "File1_Name.xls*"
        If Dir(sFile) = Empty Then
            MsgBox "File: " & sFile & vbCr & "...was not found", , "File Doesn't Exist"
            Exit Sub
        Else
            Set wbFile1_Name = Application.Workbooks.Open(ActiveWorkbook.Path & "\" & Dir(sFile))
        End If
    ElseIf returnedVal1 = "File2_Name" Then
        sFile = ActiveWorkbook.Path & "\" & "File2_Name.xls*"
        If Dir(sFile) = Empty Then
            MsgBox "File: " & sFile & vbCr & "...was not found", , "File Doesn't Exist"
            Exit Sub
        Else
            Set wbFile2_Name = Application.Workbooks.Open(ActiveWorkbook.Path & "\" & Dir(sFile))
        End If
    Elseif ...
    
    Endif
    Exit Sub
    Last edited by Mota; 08-11-2017 at 04:58 PM. Reason: Adjust my post to match the rules requirements

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. variable formula to retrieve unique values from multiple criteria
    By deanusa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-22-2016, 05:13 PM
  2. Import CustomUI/Ribbon at Opening Excel
    By Dubrock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-25-2015, 05:00 AM
  3. Excel 2013 Issue with CustomUi Onload
    By nicholas.phillips in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 03:22 AM
  4. How to make appear TAB created using CustomUI editor in all excel
    By Amit112009 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2014, 10:12 PM
  5. Replies: 3
    Last Post: 01-13-2014, 12:46 PM
  6. [SOLVED] Resetting the CustomUI Ribbon Checkbox back to Unchecked
    By BuckoAk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2012, 05:42 AM
  7. customUI Commands
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2009, 02:52 AM

Tags for this Thread

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