Using an event to set that /ignore is just a little crazy. You will be filling up your ignore list pointlessly everytime someone sends a PRIVMSG to you. Why not do as moho and Dana suggested to begin with?
/ignore -p *!*@*
That will ignore ALL private messages from all sources. No windows will open, no events will trigger, no ignore lists will get huge. Personally, I prefer to use the mask *!~*@* because a large percent of the spammers use unIDENTd'd clients, for one reason or another.
On bahamut-based networks like DALnet, you can even stop the traffic at the server before it ever gets to mIRC (preventing DDoS IRC drone attacks from SendQing you offline by filling up your SendQ buffer).
/silence +*!*@* or /silence +*!~*@*
If you absolutely MUST use an event to ignore certain people for some reason (timed unignore/user levels/etc.), then use the on OPEN event and halt it (which also prevents the window from opening).