I've installed Microsoft office web apps offline in the VM and also Installed SharePoint 2016 in another VM machine. Both VMs are connected to the domain.
Besides, I've successfully connected SharePoint to the office farm. But when I try to open docx
files or any other office app on the web browser I get the below error :
Based on the error that you have screenshoted, the Application falied to launch the MS Word Desktop Client because the scheme "ms-word" does not have a handler registered, which in simple terms means that there isn't any associated app to execute when the beforementioned scheme is used and in order to have the scheme registered with an application, you would have to install Microsoft Office on the machine that you are using to view the SharePoint Site.
Here is the link to the documentation where is states that the scheme handlers are registered upon the installation of Microsoft Office.
But in order to use the Web counterparts of the Office apps, like Word or Excel in the browser, there is a different procedure where it is required of you to Install a Office Online Server and enable communication with SharePoint Server.
As it is written in the overview of the product...
Since it's a lengthy procedure and there are different prerequisites in term of licensing and other matters, you can check out this link (Configure Office Online Server for SharePoint Server) on the topic and decide which features you are looking for.