Prevent user from closing form using caption close button 
Author Message
 Prevent user from closing form using caption close button

Dear all,

I try to find a solution to prevent the user to close a userform in Word97 with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander



Wed, 22 Oct 2003 02:21:20 GMT  
 Prevent user from closing form using caption close button
Hello Alexander,

Have you tried working with the hwnd for "ThunderDFrame"? That's the class
name for Forms20.



Wed, 22 Oct 2003 06:07:32 GMT  
 Prevent user from closing form using caption close button
Is the "caption close" button, the"x" in the title bar?
If so, the Userform_queryclose works in VBA just as it does in VB.

--
Please post your response to the newsgroup.

http://www.standards.com/ipusers/standards; Word macros, including
converting from WordBasic to VBA; Technical writing and reviewing; Standards
------------------------------------------------

Dear all,

I try to find a solution to prevent the user to close a userform in Word97
with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar
functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of
the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander



Wed, 22 Oct 2003 17:21:09 GMT  
 Prevent user from closing form using caption close button
Thanks for this hint, this was exactly what I was looking for.
If I had a deeper look myselfe I should have found the solution.

Anyway thanks a lot.

rgds,

Alexander

Quote:
-----Original Message-----

Is the "caption close" button, the"x" in the title bar?
If so, the Userform_queryclose works in VBA just as it does in VB.

--
Please post your response to the newsgroup.

http://www.standards.com/ipusers/standards; Word macros, including
converting from WordBasic to VBA; Technical writing and reviewing; Standards
------------------------------------------------


Dear all,

I try to find a solution to prevent the user to close a userform in Word97
with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar
functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of
the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander

.



Thu, 23 Oct 2003 01:45:01 GMT  
 Prevent user from closing form using caption close button
No I haven't but the solution from Kaikow Howard solved the problem.

Thanks anyway,

Alexander

Quote:
-----Original Message-----

Hello Alexander,

Have you tried working with the hwnd for "ThunderDFrame"? That's the class
name for Forms20.

.



Thu, 23 Oct 2003 01:46:31 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How can I prevent users from closing a form with the caption button (x)

2. VBA Excel 2000 - How to prevent the Close button on a user form

3. Prevent user form closing Access with the X button

4. User Form close buttons and timer close

5. Disable Access Close Button not Form Close Button?

6. Errors when closing a workbook using top right close (x) button

7. Errors when closing a workbook using top right close (x) button

8. User form Button not running code until form closes

9. Cancel/close form command button causes app to close

10. Close command button allows form to be closed when required fields are left blank


 
Powered by phpBB® Forum Software © phpBB Group