"Entering the secret code will open the gate immediately." - does this expression make sense?
I found in a textbook on technical writing that the following expression is incorrect.
Entering the secret code, the gate will open immediately.
The book says that the correct expressions are the ones below.
When you enter the secret code, the gate will open immediately.
When the secret code is entered, the gate will open immediately.
From the "be concise" perspective, I think the expression in the title is even better, but I am not confident enough. Please advise, and thank you for your help.
What you have is a simple SVO sentence, with the subject specifically being a gerund phrase. It is grammatical.
It's only possible to word it like this because "open" can be used in the mediopassive. Compare a sentence like "when you enter the secret code, someone will help you": there is no way to transform that into "entering the secret code will ..." (at least not without fundamentally changing the sentence: "... alert someone to help you").