I don't like the ScriptLet typelib that much...Just an opinion....

here's an api-way :

VB Code:
  1. Option Explicit
  2.  
  3. Private Type GUID
  4.     Data1 As Long
  5.     Data2 As Integer
  6.     Data3 As Integer
  7.     Data4(0 To 7) As Byte
  8. End Type
  9.  
  10. Private Declare Function CoCreateGuid Lib "ole32" (pguid As GUID) As Long
  11. Private Declare Function UuidToString Lib "rpcrt4" Alias "UuidToStringA" (pguid As GUID, pszGuid As Long) As Long
  12. Private Declare Function RpcStringFree Lib "rpcrt4" Alias "RpcStringFreeA" (psz As Long) As Long
  13. Private Declare Function CopyLongToString Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, lpString2 As Any) As Long
  14.  
  15. Public Function CreateGuid() As String
  16.     Dim TheGuid As GUID
  17.     Dim pszGuid As Long
  18.    
  19.     CoCreateGuid TheGuid
  20.     UuidToString TheGuid, pszGuid
  21.    
  22.     CreateGuid = Space(256)
  23.     CopyLongToString CreateGuid, ByVal pszGuid
  24.    
  25.     RpcStringFree pszGuid
  26.     CreateGuid = UCase(Mid(CreateGuid, 1, InStr(1, CreateGuid, vbNullChar) - 1))
  27. End Function
  28.  
  29. Private Sub Form_Load()
  30.     Debug.Print CreateGuid
  31. End Sub