E
ES
I am trying to create a subroutine that I can use to populate specific
listboxs depending on where the user is in the application. I can make it
work by reusing the code in several places but I would prefer to call a
single routine from all the locations. I am having trouble getting the
specific control into a parameter of the subroutine.
Public Sub SelectFiles(ListBox As Control)
[Office.FileDialog code]
For Each varFile In .SelectedItems
ListBox.AddItem varFile
Next
End sub
Private Sub cmdSelectFile_Click()
SelectFiles (Me.lstFilesToLoad)
End Sub
I know it is not correct but I always struggle when trying to refer to
specific objects in code. I just can not get it clear in my head how objects
have to be referred to in a variable.
Any pointers would be greatly appreciated.
listboxs depending on where the user is in the application. I can make it
work by reusing the code in several places but I would prefer to call a
single routine from all the locations. I am having trouble getting the
specific control into a parameter of the subroutine.
Public Sub SelectFiles(ListBox As Control)
[Office.FileDialog code]
For Each varFile In .SelectedItems
ListBox.AddItem varFile
Next
End sub
Private Sub cmdSelectFile_Click()
SelectFiles (Me.lstFilesToLoad)
End Sub
I know it is not correct but I always struggle when trying to refer to
specific objects in code. I just can not get it clear in my head how objects
have to be referred to in a variable.
Any pointers would be greatly appreciated.