Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As Long
    Private Function CreateGUID() As String
          
        Dim id(0 To 15) As Byte
          
        Dim Cnt As Long, GUID As String
          
        If CoCreateGuid(id(0)) = 0 Then
              
            For Cnt = 0 To 15
                CreateGUID = CreateGUID + IIf(id(Cnt) < 16, "0", "") + Hex$(id(Cnt))
            Next Cnt
              
            CreateGUID = Left$(CreateGUID, 8) + "-" + Mid$(CreateGUID, 9, 4) + "-" + Mid$(CreateGUID, 13, 4) + "-" + Mid$(CreateGUID, 17, 4) + "-" + Right$(CreateGUID, 12)
          
        Else
              
            MsgBox "Error while creating GUID!"
              
        End If
          
    End Function

相关文章:

  • 2021-08-14
  • 2021-11-15
  • 2021-06-03
  • 2021-10-12
  • 2022-01-16
  • 2021-12-25
  • 2021-11-17
猜你喜欢
  • 2021-11-03
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案