handleman
Automotive
- Jan 7, 2005
- 3,411
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!
-handleman, CSWP (The new, easy test)
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)