Disable X button on forms (VBA)
Disable X button on forms (VBA)
(OP)
I would ask this over at the VBA forum, but it looked kinda dead over there, so I'll ask here (since this is for a macro anyway).
Is there a simple method to disable the X button on a VBA form that will work within SW's VBA? On this macro Rigid Custom Properties, the X Button is taking an action that is causing some bizarre activity, so i just want to disable it. It's causing the deletion of the custom properties...I realize this may be do to sloppy coding by me, but in lieu of rewriting this macro, I would like to just disable the X button.
Is there a simple method to disable the X button on a VBA form that will work within SW's VBA? On this macro Rigid Custom Properties, the X Button is taking an action that is causing some bizarre activity, so i just want to disable it. It's causing the deletion of the custom properties...I realize this may be do to sloppy coding by me, but in lieu of rewriting this macro, I would like to just disable the X button.
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group






RE: Disable X button on forms (VBA)
http://www.vbforums.com/showthread.php?t=363931
I don't think it's going to be possible without using the Windows API as in the example there.
BTW, this is the first link when you google the subject line of your post.....
-handleman, CSWP (The new, easy test)
RE: Disable X button on forms (VBA)
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
RE: Disable X button on forms (VBA)
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
RE: Disable X button on forms (VBA)
It fires when the 'x' button is pressed. Setting 'Cancel' to something non-zero cancels the action.
CODE
If CloseMode = vbFormControlMenu Then Cancel = 1
End Sub
Cheers...
RE: Disable X button on forms (VBA)
-handleman, CSWP (The new, easy test)
RE: Disable X button on forms (VBA)
Thanks. I just couldn't didn't figure out that part. I thought it was asking for the actual name of the form.
VanHunks,
Thanks for the reply. Playing with how the X button works didn't work too well for me, as there are functions that I sometimes want available even when the form is closed. Having the button available but not function is cool, but also a little annoying to the user. I'll be adding that code to my snipplets list though. :)
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group