-
-
Save blackskye-sx/31a09b10e81d26ee6c49e88d7a3456e8 to your computer and use it in GitHub Desktop.
Generate a GUID from VBA or VBScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function GenGuid() As String | |
Dim TypeLib As Object | |
Dim guid As String | |
Dim guid2 As String | |
Set TypeLib = CreateObject("Scriptlet.TypeLib") | |
guid = Left$(TypeLib.guid, 38) | |
Set TypeLib = Nothing | |
' format is {24DD18D4-C902-497F-A64B-28B2FA741661} | |
guid = Replace(guid, "{", "") | |
guid = Replace(guid, "}", "") | |
'Guid = Replace(Guid, "-", "") | |
'Return result | |
GenGuid = guid | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment