Formal modeling notations and visual modeling notations can complement each other when developing software models. The most frequently adopted approach is to define transformations between the visual and formal models. However, a significant problem with the currently suggested approaches is that the transformation itself is often described imprecisely, with the result that the overall transformation task may be imprecise, incomplete and inconsistent. This paper presents a formal metamodeling approach to transform between UML and Object-Z. In the paper, the two languages are defined in terms of their formal metamodels, and a systematic transformation between the models is provided at the meta-level in terms of formal mapping functions. As a consequence, we can provide a precise, consistent and complete transformation between a visual model in UML and a formal model in Object-Z