The best way to prevent this "automatic execution" is to keep your tools (IE, Outlook, Windows) updated. Of course, it's possible that a new exploit will be found and abused before a patch is released, but usually, the worms use old bugs (where the fix is already available).
You say you received a virus from your friend - most of today's viruses fake the Sender address... are you sure you really know where it came from?