I'm sorry that I posted you a Link with an Information, which isn't working. I thought that posts on MSDN would word - my mistake. By searching in the Internet I found more Snippets like the posted one, which have nearly the same code.
But now I have a Link for you which guides you to a working solution :
https://www.vb-paradise.de/index.php/Thread/68853-alle-bildschirmaufloesungen-ermitteln-und-wechseln/[
^]
I hope, that it is not a big problem for you that the linked Forum is a German one.
You only have to load the ZIP-File and the end of the Thread at the User 'Erfinder des Rades' (Inventor of the Wheal).
This Code I have tested and it works ... ;)
Greetings
Ralf