View Single Post
 
Old 05-10-2011, 03:54 AM
Cbrehm Cbrehm is offline Windows 7 64bit Office 2003
Novice
 
Join Date: May 2011
Posts: 8
Cbrehm is on a distinguished road
Default looping controls on userforms

Excel 2002
On a userform I have some Textboxes, listboxes, etc that I want to set .value=empty

Currently I do it by
'clear some values
Code:
TSEFAN.Value = empty
    TSEFPD.Value = empty
    TSEFAP.Value = empty
Now I have tried,

Code:
Sub controlempty(formname As MSForms)
    'pass form name to use

Dim cCont As Control

    For Each cCont In formname

        .Value = Empty

    Next cCont

End Sub
then in the code for saving the data I have the line
Code:
controlempty ADDCORT
ADDCOURT is the name of the form

get error "Expected user-defined type, not project"

Help Thanks

Last edited by Cbrehm; 05-10-2011 at 05:02 AM. Reason: More info
Reply With Quote