His remarks came as the royal unveiled a commemorative plaque to celebrate the completion of a £6 million project to restore historic Riddle’s Court in the Scottish capital.
A large crowd cheered as Charles walked up the Royal Mile and entered the close on Friday.
Once inside the 16th century building - where King James VI held banquets - he was taken on a tour and gave a speech to people involved with the project.
The Prince said: “Edinburgh is so special for finding wonderful places, hiding behind unexpected facades.
“I only wish I had more time to explore Edinburgh. It’s always been, for me, a very special city.
“I’m very touched to be invited to come and help open Riddle’s Court after its endless restoration.
“I just wanted to use the opportunity to congratulate the (Scottish Historic Buildings) Trust, because I know just how many marvellous projects they are involved with in trying to bring so many special buildings back to life.”
Riddle’s Court is one of the earliest surviving courtyard houses in Edinburgh’s Old Town and an important A-listed property.
It contains significant architectural features including a rare late 16th century painted beam ceiling, an early 17th century plaster ceiling and a late 19th century ceiling by TK Bonnar.
Charles met people involved with the restoration project and was shown to unique parts of the property, including a disabled toilet which used to be an oven.
During its history, the building has been a merchant’s house, a venue for a banquet held by King James VI, aristocratic apartments, overcrowded tenements, emergency post-war housing, a community learning centre and an Edinburgh Fringe Festival venue.
Many influential and creative people have lived or been associated with the building, including Sir John Clerk of Penicuik, Sir David Hume and Sir Patrick Geddes.
As well as a visitor attraction and space for conferences and events, it will become home to the Patrick Geddes Centre for Learning.
An extensive international learning and conservation programme will be developed for it, based on the educational ethos evolved from Geddes’ saying Vivendo Discimus - By Living We Learn.
The restoration project has been carried out by the Scottish Historic Buildings Trust (SHBT).
Una Richards, director of SHBT, said: “We were honoured to welcome His Royal Highness to view our work at Riddle’s Court and show him around the new Patrick Geddes Centre for Learning. His interests in conservation, town planning, the environment and learning closely align to the work of Geddes and the Centre.
“It is exciting to bring such an important building back to life and find relevant and sustainable new uses for it that will benefit the people of Edinburgh and learners worldwide for many years to come.”