Olav died in 1387, before he came of age and could take over the government, so Margaret made the Danish Council of the Realm elect her as regent of Denmark, but she did not attempt to assume the title of queen.
The Nordic union was established on 17 June 1397 by the Treaty of Kalmar, signed in the Swedish castle of Kalmar on Sweden's south-east coast, which in medieval times was close to the Danish border.