I'm trying to make a macro that will allow me to list and apply any available macro to any available worksheet/workbook. The below code already allows me to see the available worksheets/workbooks but I don't know how to update the language to include the available macros (both from my personal file and any additional macros from already open workbooks).
Code:
Option Explicit
' ComboBox1 => Displays workbooks
' ComboBox2 => Displays worksheets
Private Sub CommandButton1_Click()
Dim oWb As Workbook, oSh As Worksheet
Set oWb = Workbooks(ComboBox1.Value)
Set oSh = oWb.Sheets(ComboBox2.Value)
oSh.Activate
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim oWb As Workbook
For Each oWb In Workbooks
ComboBox1.AddItem oWb.Name
Next oWb
ComboBox1.ListIndex = 0
End Sub
Private Sub ComboBox1_Change()
Dim oWb As Workbook, oSh As Worksheet
ComboBox2.Clear
Set oWb = Workbooks(ComboBox1.Value)
For Each oSh In oWb.Sheets
ComboBox2.AddItem oSh.Name
Next oSh
ComboBox2.ListIndex = 0
End Sub