I recently ran into a situation where I had to re-install Office 365 and continuously received this, or similar errors when attempting to do so.  I tried quite a few things that were supposed to fix it.  The registry modification below is what worked for me.
Delete the Office registry subkeys to fix Error Code
  1. Open Registry Editor.
  2. Delete the following registry subkeys: