Excel2003中能否随机生成一个Guid码? 想在Excel2003中随机生成一个Guid码,不知道可不可以,如果可以,求指教,详细些好,多谢,在线等! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用VB宏,自己没做过,找了个:Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As LongPrivate 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 嗯 这个宏我也见过 ,不过 在Excel里怎么用呀?以前从没有用过这个功能 呃 这句能在Excel里用不!? textBox外点击事件 调用.htm问题 同事接口写完了,我该怎么向他传值 请教一个SQL数据库用C#读取方法! IE组件编程迷你问题 === 针式打印机问题 === 经典SQL语句,来者有分... 关于TEXTBOX的数据绑定问题 怎样用JavaScript获得IE滚动条当前的值 请问如何锁定打开文件的路径?谢谢 C# SqlDataReader GetString取值问题 udpClient的怪异问题
Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As LongPrivate 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