Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Clearing data from a Userform when completed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nurds - 05 Oct 2006 13:29 GMT
I have created a Word Template using a table that is populated using a
Userform.  It all works fine, but when I close the file down and then re-open
it to use it again, the Userform appears with all the previous data still in
it.  Am I able to add a line of code that clears all the data from the
userform once the file is closed, thereby leaving a blank userform each time
the file is re-opened?  This even applies if I don't save the file upon
closing.  Any help on this would be much appreciated.
Thanks.
Karl E. Peterson - 05 Oct 2006 19:44 GMT
> I have created a Word Template using a table that is populated using a
> Userform.  It all works fine, but when I close the file down and then
[quoted text clipped - 4 lines]
> This even applies if I don't save the file upon closing.  Any help on
> this would be much appreciated.

Create and use new *instances* of the UserForm, rather than repeatedly
calling the autoinstantiated default instance.  IOW, when you want to show
it, do this:

  Dim frm As FMyUserForm
  Set frm = New FMyUserForm
  ' set any custom properties
  frm.Show

Then, to get rid of it:

  frm.Hide  'Assuming this isn't done from within
  Set frm = Nothing

Later...   Karl
Signature

Working without a .NET?
http://classicvb.org/


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.