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

Tip: Looking for answers? Try searching our database.

Modal/Modeless User Forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Conan Kelly - 17 Mar 2006 19:01 GMT
Hello all,

Inside a Do...While loop I show a user form.  Right before the user form is displayed, the code selects some text.  The user form
asks if the selected text is correct with yes, no, and cancel buttons.

What I need it to do is display the form as modeless WITHOUT continuing code execution.  I need it to be modeless so I can scroll
the document to see if the selected text is correct, since the selected text is larger than the screen.  If I show the form as
modal, I can't scroll the window.  If I show the form as modeless, the code continues to execute.

How can I show the form as modeless, but pause code execution until a button on the form is clicked?

Thanks for any help anyone can provide,

Conan Kelly
Robert Paulsen - 17 Mar 2006 20:41 GMT
The following code worked for me. I added a user form with one button. I was
able to scroll the document while the form was showing, and once I clicked ok
I saw a message box I inserted in the command button, hid the form, and then
received my message box after the Do...Loop. If using the Visible property of
the form isn't satisfactory, you can add a Public property to the form and
set it to the appropriate value in your command button (i.e. Do While
myForm.myProperty = False).

   Dim myForm As New UserForm1
   
   myForm.Show 0
   
   Do While myForm.Visible
       DoEvents
   Loop
   MsgBox "xxx"

> Hello all,
>
[quoted text clipped - 10 lines]
>
> Conan Kelly
 
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.