I know this post is 5 years old, but I'm having this exact same issue with InfoPath 2010 on Windows 7. Did you ever resolve your problem? I've tried reinstalling VSTA, uninstalling Office SP1, reinstalling Office, reinstalling the .NET framework, and nothing resolves the issue.
I can create VSTA code in a new InfoPath form, but as soon as ...