查看单个帖子
旧 2009-04-12, 09:20 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to grey out a customized macro button

how to "grey out" a customized macro button
hi,
i have created a macro that i use to save a drawing file in a pdf format and i assigned it to a custom button on my toolbar.
i am interested in "greying out" the button so it only works when a drawing file is open and not a part or an assembly. is there any way to do this? that is, i don't want to be able to accdently click on the button when i am working on a part
it is possible, but pretty difficult, to gray out the button. i would recommend placing the button on some toolbar that is only visible when you are in a drawing. i would also advise to add code (if you haven't already) that checks what type of document is active at the beginning of the macro and to exit if the document is wrong...
if application.sldworks.activedocument.gettype <> swdocdrawing then exit sub
i'll get you eh steve, if it's the last thing i dooooo!
thanks josh,
that will work fine. i ended up writing
set swapp = createobject("sldworks.application")
set model = swapp.activedoc
if model.gettype <> swdocdrawing then
msgbox ("this can only be used in drawing files.")
exit sub
end if
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)