![]() |
|
|
|
#1
|
|||
|
|||
|
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
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
Code:
controlempty ADDCORT get error "Expected user-defined type, not project" Help Thanks Last edited by Cbrehm; 05-10-2011 at 05:02 AM. Reason: More info |
|
#2
|
||||
|
||||
|
Assuming you're using TextBoxes and you're calling the code from a button or something such on the form, you could implement code like:
Code:
Dim Obj As TextBox For Each Obj In Me.Controls Obj.Text = vbNullString Next
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
||||
|
||||
|
Hi Cbrehm,
If you want to implement it like that then ControlEmpty should be a method in the userform class, so you shouldn't need to pass the instance of the userform into it. The method's signature would just be: Code:
Sub ControlEmpty Now, if, for some reason, you did want to pass in a userform object (you don't here as I said above), then your procedure would be: Code:
Sub controlempty(FormInstance As MSForms.Userform) |
|
#4
|
|||
|
|||
|
Like I said, I have comboboxes and listboxes and txtboxes, need to clear all
|
|
#5
|
||||
|
||||
|
Quote:
Quote:
|
|
#6
|
|||
|
|||
|
Yes Thank you, Sometime I over think things and make it do hard.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
how to use Building Blocks or controls to add a page
|
verbster | Word | 11 | 03-06-2011 04:05 PM |
Grouping Content Controls
|
cksm4 | Word VBA | 2 | 03-01-2011 12:46 PM |
Format picture controls are acting weird.
|
WaltR | Drawing and Graphics | 1 | 02-11-2011 02:47 PM |
hide ghosted controls
|
designer | PowerPoint | 1 | 01-03-2011 07:11 AM |
Can't Download Controls
|
BillTheAdmin | Project | 2 | 12-05-2005 10:20 AM |