motabrasil
Member
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
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
Code:
'Macro 1)
Private Sub itemCount(control As IRibbonControl, ByRef returnedVal1)
Call DropDown1
returnedVal1 = iItemcount5
End Sub
'Macro 2)
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 a moderator: