While there is no exact canon answer to your question, the visual evidence seems to indicate that the Enterprise-A was a brand-new ship. As for when it was actually built, probably not long before the end of Star Trek IV.
It's my personal belief that in Star Trek III, when Admiral Morrow informs the crew that the Enterprise will be decommissioned, that Starfleet had every intention of eventually building a new Excelsior class Enterprise-A to replace it. But because of "extenuating circumstances," another ship was hurriedly given the name while the Excelsior class ship would eventually be the B. Once the B was completed, the A was decommissioned and renamed something else (hey, it's a perfectly good ship, why not?)