Hi,
I am working on a project for other form member and I am receiving a problem with the following
The problem is sub or function not defined.
said forum member asked me to move most the code to a module to declutter the form code.
I call the sub
However, when all the code was in the form the above code worked. What am I missing?
Thanks,
Nightwalker
I am working on a project for other form member and I am receiving a problem with the following
vb Code:
Public Sub AdjustHorizScrollBar(ByRef LB As ListBox, Optional ByVal RightMargin As Long = 4&) Dim i As Integer, sngLongestText As Single, TW As Single With LB For i = 0 To .ListCount - 1 TW = TextWidth(.list(i)) If sngLongestText < TW Then sngLongestText = TW Next SendMessageW .hWnd, LB_SETHORIZONTALEXTENT, RightMargin + sngLongestText, 0& End With End Sub
The problem is sub or function not defined.
vb Code:
TextWidth(.list(i))
said forum member asked me to move most the code to a module to declutter the form code.
I call the sub
vb Code:
Private Sub Form_Load() load Form1.List1, Form1 End Sub 'In a module Public Sub load(lst As ListBox, Form As Form) AdjustHorizScrollBar lst End Sub
However, when all the code was in the form the above code worked. What am I missing?
Thanks,
Nightwalker