Can Excel or VB create GUIDs?

I have an application I am building in Excel which I believe will be migrated to SQL or Access in the future. I am using Worksheets as Tables and need to assign unique ID's in a number of places. I would like to use GUIDs from inception so as to simplify the migration process as much as possible. Can Excel of VBA auto create GUIDs?
pwanveerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark_FreeSoftwareCommented:
read this:
(both vb6 and .net)
http://www.buygold.net/v01n01/v01n01.html

direct downloadlink to (vb6) the source:
http://www.buygold.net/v01n01/guid.zip

direct downloadling to .net source:
http://www.buygold.net/v01n01/guidvb7.zip
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark_FreeSoftwareCommented:

or if you don't feel like checking that, use this code:

Declare Function CoCreateGuid_Alt Lib "OLE32.DLL" Alias "CoCreateGuid" (pGuid _
    As Any) As Long
Declare Function StringFromGUID2_Alt Lib "OLE32.DLL" Alias "StringFromGUID2" _
    (pGuid As Any, ByVal address As Long, ByVal Max As Long) As Long

Function CreateGUID() As String
    Dim res As String, resLen As Long, guid(15) As Byte
    res = Space$(128)
    CoCreateGuid_Alt guid(0)
    resLen = StringFromGUID2_Alt(guid(0), ByVal StrPtr(res), 128)
    CreateGUID = Left$(res, resLen - 1)
End Function
0
jimbobmcgeeCommented:
Or, more simply:

    Set oTypeLib = CreateObject("Scriptlet.TypeLib")
    szMyGuid = oTypeLib.Guid
    '...
    Set oTypeLib = Nothing
   
HTH

J.
0
pwanveerAuthor Commented:
A quick download of the Class Module and a quick code edit and I'm done! You are a rockstar! Thank you.
0
Mark_FreeSoftwareCommented:


thanx for the points and happy coding!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.