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 / September 2006

Tip: Looking for answers? Try searching our database.

UserForm problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sweet_dreams - 21 Sep 2006 16:43 GMT
Hi all,

I have problem with userforms in Word.

I have a template in which I have such a macro:

Sub AutoNew()

   Application.Visible = False
   UserForm1.Show
   Dim i As Integer
   For i = 1 To 10000
       ' some code
   Next i
   Unload (UserForm1)
   Application.Visible = True

End Sub

So everytime when I open new doc based on this template UserForm1 is
shown.
But unfortunately userform1 doesn't diasapear. When I try to close it
manualy I get error: "Can't load or unload this object."
So my question is how can I close programmaticaly Userform after some
code have been executed, like in my example.

Whats more I noticed that code in loop is executeg when I close this
UserForm.
What I would like to achieve is to perform some code when Word is not
visible. I need UserForm to show progess of this actions and show
information connected with what is done. But unfortunately I can't show
any code on Label which is placed on form beacuse code in loop is
executed when form is closed. Can somebode give me any clue how can I
achieve what I wanted.

Regards,
sweet_dreams
Peter - 21 Sep 2006 17:53 GMT
You should execute your code in the userform. Either in the activate event of
the form or in the click event of a command button. Your AutoNew procedure
would have only a single line; namely: Userform1.Show

Peter

> Hi all,
>
[quoted text clipped - 33 lines]
> Regards,
> sweet_dreams
 
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.