One or two postings have said that there is no relationship between Queen Elizabeth and Queen Margarethe and that they are not close.
They are, I think, 3rd cousins. King Edward VII was married to Alexandra, the sister of the then King of Denmark.
Also, Queen Margarethe is often among the private guests at Balmoral and Windsor, and I have read that there is quite a good relationship there.
Also, Anne Bowes-Lyon (a niece, I think, of the Queen Mother) was married to Pr George of Denmark, a 2nd cousin of Queen Margrethe.
I know the Queen rarely goes abroad to visit other Royal Families - and usually sends one of her children to represent her at other Royal Family weddings and anniversary parties, etc., - but many visit privately. King Hussain of Jordan was a regular visitor, as is the former Grand-Duke Jean of Luxembourg. The Queen is also quite closely related to the Norwegian Royal Family (the late King Olav was her first cousin), and more distantly to the Swedish Royal Family. There is also an even more distant connection to the Belgian Royal Family through the first King Leopold I. Oh, not to forget close relationships with the Greek Royal Family and the Spanish Royal Family, and the former German and Russian Royal Families. There is also a connection to the Roumanian Royal Family.
Come to think of it, only the Dutch, French, Portuguese, Bulgarian and Italian Royal Families are not related to Queen Elizabeth.