' Create a new VB5 standard EXE project. ' Copy and paste this code into a .BAS module ' In Form_Load, type: Msgbox CreateGUID() ' Run the project. Option Explicit Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Declare Function StringFromGUID2 Lib "ole32.dll" (rguid As GUID, ByVal lpsz As Long, ByVal cbMax As Long) As Long Declare Function CoCreateGuid Lib "ole32.dll" (GUID As GUID) As Long Function CreateGUID() As String Dim pguid As GUID Dim strGUID As String Dim lRetVal As Long lRetVal = CoCreateGuid(pguid) strGUID = String$(38, 0) StringFromGUID2 pguid, StrPtr(strGUID), Len(strGUID) + 1 CreateGUID = Mid(strGUID, 2, 36) End Function