Resetting objects in userform 
Author Message
 Resetting objects in userform

Hi everybody,
I have an application with quite a number of textboxes and listboxes .
I want to reset them to their previous values when I click "reset" button in
the form.
Is there a single command which will reset all the objects in a useform.
I remember seeing something like this before here but cannot find it now.
Any suggestions will be welcome

-tim



Wed, 18 Jun 1902 08:00:00 GMT  
 Resetting objects in userform

For each cntrl in Userform1.Controls
   if typeof cntrl is MSForms.Textbox then
     cntrl.text = ""
   elseif  typeof cntrl is MSForms.Listbox then
      cntrl.Listindex = -1
   end if
Next

Note:  Code has not been placed in the VBE and benchtested, so it may
contain typos.

Regards,
Tom Ogilvy
MVP Excel


Quote:
> Hi everybody,
> I have an application with quite a number of textboxes and listboxes .
> I want to reset them to their previous values when I click "reset" button
in
> the form.
> Is there a single command which will reset all the objects in a useform.
> I remember seeing something like this before here but cannot find it now.
> Any suggestions will be welcome

> -tim



Wed, 18 Jun 1902 08:00:00 GMT  
 Resetting objects in userform

success !!
Thanks Tom,


Quote:
> For each cntrl in Userform1.Controls
>    if typeof cntrl is MSForms.Textbox then
>      cntrl.text = ""
>    elseif  typeof cntrl is MSForms.Listbox then
>       cntrl.Listindex = -1
>    end if
> Next

> Note:  Code has not been placed in the VBE and benchtested, so it may
> contain typos.

> Regards,
> Tom Ogilvy
> MVP Excel



> > Hi everybody,
> > I have an application with quite a number of textboxes and listboxes .
> > I want to reset them to their previous values when I click "reset"
button
> in
> > the form.
> > Is there a single command which will reset all the objects in a useform.
> > I remember seeing something like this before here but cannot find it
now.
> > Any suggestions will be welcome

> > -tim



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Variable(s) Reset by Showing 2nd UserForm on top 1st UserForm

2. Object missing in UserForm's object cbo-box

3. Resetting variables in userform

4. Reset a UserForm

5. Resetting userform controls en mass

6. recalling a userform and resetting document

7. Help: Reset Variables, object exists etc.

8. Reset Linked Picture Object

9. Resetting variables and objects

10. Flash objects - reset after play?


 
Powered by phpBB® Forum Software © phpBB Group