Non-Modal Message Box/Input Box
Non-Modal Message Box/Input Box
(OP)
For those of you who write VBA macros, here are a couple of quick user forms I made as substitutes for MsgBox and InputBox. They are not intended to replace every use of MsgBox and InputBox, they are only for use when your user might want to interact with the model before continuing with the macro. I wrote them for the mating macros I've posted here in the past, because sometimes adding a mate moves the part/assembly out of the current field of view. When the macro uses a MsgBox to prompt the user to accept/flip alignment, the user can't rotate/pan/zoom the model to check it. It could also be used to prompt the user to select certain features/entities prior to continuing.
These user forms are designed to be easily used in existing code as an almost direct syntactical replacement for the vbYesNo type message box and the InputBox. Of course, they are not as flexible (especially the YesNoBox) as far as options go, but once imported into a macro the form can be changed if desired.
Pausing code execution is handled by the form, so no additional coding is needed in the main macro. It uses a loop with DoEvents, so you won't want to use it in a situation where you have the box open for a long time.
Enjoy!
These user forms are designed to be easily used in existing code as an almost direct syntactical replacement for the vbYesNo type message box and the InputBox. Of course, they are not as flexible (especially the YesNoBox) as far as options go, but once imported into a macro the form can be changed if desired.
Pausing code execution is handled by the form, so no additional coding is needed in the main macro. It uses a loop with DoEvents, so you won't want to use it in a situation where you have the box open for a long time.
Enjoy!
-handleman, CSWP (The new, easy test)






RE: Non-Modal Message Box/Input Box
ht
RE: Non-Modal Message Box/Input Box
RE: Non-Modal Message Box/Input Box
Of course, these could (should?) all probably be condensed down into one macro as noted above. I just haven't managed to do it yet.
-handleman, CSWP (The new, easy test)
RE: Non-Modal Message Box/Input Box
RE: Non-Modal Message Box/Input Box
That's one hell of an algorithm you've got there for getting the initial mating distance. How long did it take you to work that out? Or was it in a SW example somewhere? I does an excellent job of replicating the distance calculation done by SW itself.
RE: Non-Modal Message Box/Input Box
For using Hotkeys...I got a mouse with a couple programmable buttons (Logitech MX5?? or MX6??) and programmed on of the keys to be [Shift]+[Ctrl]...so now I hold that button down with my mouse thumb and have an entire keyboard of available single-key HotKeys.
Ken
RE: Non-Modal Message Box/Input Box
Probably way too long. It's been a while, but I would say probably 3-4 hours altogether. It was one of those things where you get an idea of how to do something, and you think it'll work, and it almost does, but you have to keep adding tweaks and intermediate steps (all those part-to-assembly transforms, for example) until after a while you have a big ol' ugly section of code that mostly works.
-handleman, CSWP (The new, easy test)