For database aficionados:

Function GUID() As String

Dim db As New REALSQLDatabase

If db.Connect Then Return db.SQLSelect("select hex( randomblob(4)) " _

+ "|| '-' || hex( randomblob(2)) " _

+ "|| '-' || '4' || substr( hex( randomblob(2)), 2) " _

+ "|| '-' || substr('AB89', 1 + (abs(random()) % 4) , 1) " _

+ "|| substr(hex(randomblob(2)), 2) " _

+ "|| '-' || hex(randomblob(6)) AS GUID").Field("GUID")

Return "ERROR"

End Function

Added remarks:1) randomblob is a SQLite core function, and in the SQLite docu it is explicitly mentioned to use for generating a guid. See:

http://www.sqlite.org/lang_corefunc.html2) The function above generates a type 4 GUID, according to the documentation available here:

https://secure.wikimedia.org/wikipedia/en/wiki/Uuid3) Version 4 UUID (random) are not 100% unique. However, if constructed according to the documentation, then a collision is highly unlikely.

"... after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%. The probability of one duplicate would be about 50% if every person on earth owns 600 million UUIDs."From: "Random UUID probability of duplicates",

https://secure.wikimedia.org/wikipedia/en/wiki/Uuid#Random_UUID_probability_of_duplicates