--- In [email protected], "Dave Knorr" <[EMAIL PROTECTED]> wrote: > > Ultimately I'd like to fire a small program only when the Excel viual > basic editor is running. I'm nearly iliterate with scripting, but > I've tried to use HookWindowEvents. I can detect when the editor > starts, but not when it leaves. Here is the script I'm using: > > ;;--start > Exec.OnError("file") > if ( win.caption(arg(2))=="Microsoft Visual Basic - Personal Macro > workbook.xls" ) do > if ( arg(1)==3 ) do > message "Hello VBE" > endif > if ( arg(1)==4 && win.caption(arg(2))=="Microsoft Visual Basic - > Personal Macro workbook.xls") do > message "goodbye VBE" > endif > endif > ;;--end > > Behavior is I get the message when the editor is created, but nothing > when it is destroyed. I've also been unsuccessful with other > variations: using win.class; win.exename; using a separate button to > see if the editor window is present ...
Basically your script is correct, but seems a bit redundant: if(win.caption(arg(2))=="Microsoft Visual Basic - Personal Macro workbook.xls")do if(arg(1)==3) message "Hello VBE" if(arg(1)==4) message "goodbye VBE" endif Sean Attention: PowerPro's Web site has moved: http://www.ppro.org Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/power-pro/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
