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 / February 2007

Tip: Looking for answers? Try searching our database.

How to Make Word 97 UserForm Modeless

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 14 Feb 2007 13:56 GMT
Hi, my main goal that I am trying to accomplish is having 2 command buttons
be visible at all times within a document. The simplest way (if my company
was using a newer version of Office) would be to create a modeless UserForm.  
So needless to say, I am having an issue with this one.

I have received input from another thread to try to use the following code,
but to no avail:

Quote

The next piece of code will set the current form modeless.
It relies on some sort of  bug(feature) in Word.
The only problem remains is, that when the form re-gets it focus after you
done the things you wanted to do in the word window,
no event is triggered. But, for your form this does not seem to be needed.

Public Declare Function GetActiveWindow Lib "User32" () As Long
Public Declare Sub SetActiveWindow Lib "User32" (ByVal hWnd As Long)

Sub SetMeModeless(KeepFocus As Boolean)
Dim hWnd As Long
   hWnd = GetActiveWindow
   SendKeys ("{ESC}")
   Dialogs(wdDialogFileOpen).Display
 ' use this line when the sendkey does not work, but it's a little bit
 ' slower:  Dialogs(wdDialogFileOpen).Display (1)
   If KeepFocus Then SetActiveWindow (hWnd)
End Sub

Unquote

Does anyone have any ideas on this one?  A UserForm does not need to be used
if another option is available.  I would appreciate any input.

Jason
Jean-Guy Marcil - 14 Feb 2007 15:30 GMT
Jason was telling us:
Jason nous racontait que :

> Hi, my main goal that I am trying to accomplish is having 2 command
> buttons be visible at all times within a document. The simplest way
> (if my company was using a newer version of Office) would be to
> create a modeless UserForm. So needless to say, I am having an issue
> with this one.

If all you need are command buttons why don't you use  toolbar buttons?

Do you want to invest that much energy on a now archaic version of Word that
is no longer supported by Microsoft?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Jason - 15 Feb 2007 16:27 GMT
Thanks for the input.  That was my initial thought, but a tool bar is not as
visible to inexperienced end users as would be a command button or user form
directly on the document.

However, it appears that this is my only option at this point, so thanks for
the reply.

And by the way, if the only option for my company is Word 97, then yes, I do
want to invest the time.  :)

Jason

> If all you need are command buttons why don't you use  toolbar buttons?
>
> Do you want to invest that much energy on a now archaic version of Word that
> is no longer supported by Microsoft?
 
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.