Hi there,
I have a button that links to a userform, with the following code:
Private Sub CommandButton1_Click() 'the okay button is titled "commandButton1 by default in each new userform"
wbName = Me.ComboBox1.Value
Unload Me
Sheets("Start").Range("B9").Value = wbName
End Sub
Sub UserForm_Initialize()
On Error Resume Next
'set reference to Microsoft Visual Basic for Applications
'Extensibility 5.3
ThisWorkbook.VBProject.References.AddFromGuid _
"{0002E157-0000-0000-C000-000000000046}", 5, 3
'now get the list of macros
Call GetTheList
End Sub
Private Sub GetTheList()
Dim N&, Count&, MyList(200), List$
Dim Component As VBComponent
For Each Component In ActiveWorkbook. _
VBProject.VBComponents
With Component.CodeModule
Count = .CountOfDeclarationLines + 1
Do Until Count >= .CountOfLines
MyList(N) = .ProcOfLine(Count, _
vbext_pk_Proc)
Count = Count + .ProcCountLines _
(.ProcOfLine(Count, vbext_pk_Proc), _
vbext_pk_Proc)
If MyList(N) Like "DW_*" Then
Me.ComboBox1.AddItem MyList(N)
End If
If Count < .CountOfLines Then N = N + 1
Loop
End With
N = N + 1
Next
End Sub
The important part of this is the sub GetTheList(), which creates a list of all macros in my workbook which start with the letters DW. For some reason, when anyone else tries to open this workbook on their computer, they click the button which operates this macro, and they get zero results, but it works perfectly for ME.
What setting might I have enabled that is causing this to work that they are not? I can't figure out why this would not be functioning correctly!
Bookmarks