Modify Z value of a block vertex but keep the dimension & angle (batch task)

Hello, I've got a large number of blocks (200x300) where the vertexes have different z values (3D rotation). My task is to drop all vertexes to Z=0 (make all blocks flat) but keep the block dimension & angle.

When changing all Z values to '0', the vertexes are perpendicular projected on the plane and the block gets deformed (new BLOCK DIM 197.65x298.38). 

Does anyone know how to perform my task for a large number of blocks by VBA or other way?

Thanks in advance!