![]() |
【转帖】make x button exit macro
make x button exit macro ?
hi, i just stumbled across something a little annoying to me. the x button in the top right corner of a form does not exit the macro it just exits the form and continues to run the rest of the macro. can you make the the button exit the macro ? i know i could just make a cancel button but i am just wondering if it works. thanks. solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 answer you should be able to use the terminate procedure. when you are programming in your code for your form there are two dropdown lists at the top of the dialog box. the one one the left may say userform if not dropdown the list and pick "userform". in the dropdown on the right choose "terminate." this will create a sub called terminate. enter your end code in that sub. hope this works dan miel thanks i guess that is simple enough. solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 originally posted by: dan miel you should be able to use the terminate procedure. when you are programming in your code for your form there are two dropdown lists at the top of the dialog box. the one one the left may say userform if not dropdown the list and pick "userform". in the dropdown on the right choose "terminate." this will create a sub called terminate. enter your end code in that sub. hope this works dan miel if using only vba, this doesn't work well. matt lorono solidworks 2007 sp3.1 cad engineer/ecn analyst hi matt, what would you suggest then ? solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 disable the x button and include a cancel button on the form. originally posted by: dominic cozzitorto disable the x button and include a cancel button on the form. yup, this is what i do. sorry for responding late. matt lorono solidworks 2007 sp3.1 cad engineer/ecn analyst thanks solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 what do i need to do to disable to the x button in vba then? drc inc. minneapolis, mn .designreadycontrols.com sw2007 sp5.0 core2 quad 3gb ram xp pro sp2 ati firegl v3600 originally posted by: john bjerke what do i need to do to disable to the x button in vba then? if no one else gets to answer this today, i'll post the answer a bit later. it requires particular code. matt lorono solidworks 2007 sp3.1 cad engineer/ecn analyst your problem is just that the macro will run until it reaches the end of the main function, so showing/hiding a form has no effect on this unless say you show a form modal and the line after that is the end of the main() function. you are best uploading your code or posting an example to see where you are going wrong in the design phase and we can solve the problem instead of working around it. |
所有的时间均为北京时间。 现在的时间是 12:01 AM. |