Passing control name to sub

N

Nigel

I'm having trouble passing a MSFlexGrid control to a sub. The control name
is "flxGalleries". The error is "Type Mismatch. Error '13'". I have the
following code:

Private Sub Form_Open (Cancel as Integer)
... do stuff ...
GridSetup flxGalleries 'Call the Sub and pass the Control
... do more stuff ...
End Sub

Public Sub GridSetup (ByRef flxGrid As MSFlexGrid)
With flxGrid
... do stuff ...
End With
End Sub

What have I done wrong?

Cheers
 
D

Dorian

Try:

Call GridSetup(flxGalleries) 'Call the Sub and pass the Control

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
N

Nigel

Thanks Dorian,

Actually, my problem proved to be declaring the flxGrid variable as
MSFlexGrid... should have been: (ByRef FlxGrid As Object).
 
Top