R
ricksimm
Using the following code:
Sub StartPPTOptions()
Call BuildListbox(PPTOptions.Name, _
PPTOptions.ClientPPTListbox.Name, _
"ClientMain1")
End Sub
Sub BuildListbox(lbForm, lbName, lbSource)
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
Dim Item
lbForm.lbName.Clear
Set AllCells = Range(lbSource)
On Error Resume Next
For Each Cell In AllCells
NoDupes.Add Cell.Value, CStr(Cell.Value)
Next Cell
On Error GoTo 0
For Each Item In NoDupes
lbForm.lbName.AddItem Item
Next Item
End Sub
I am trying to use one sub to build quite a few listboxes by passing
the needed arguments. When it hits the lbform.lbname.Clear I get an
"Object required" error. Thanks.
Sub StartPPTOptions()
Call BuildListbox(PPTOptions.Name, _
PPTOptions.ClientPPTListbox.Name, _
"ClientMain1")
End Sub
Sub BuildListbox(lbForm, lbName, lbSource)
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
Dim Item
lbForm.lbName.Clear
Set AllCells = Range(lbSource)
On Error Resume Next
For Each Cell In AllCells
NoDupes.Add Cell.Value, CStr(Cell.Value)
Next Cell
On Error GoTo 0
For Each Item In NoDupes
lbForm.lbName.AddItem Item
Next Item
End Sub
I am trying to use one sub to build quite a few listboxes by passing
the needed arguments. When it hits the lbform.lbname.Clear I get an
"Object required" error. Thanks.