Multiple Apps

Create a GUID (Globally Unique Identifier)

Ease of Use

Easy

Version tested with

2003 

Submitted by:

Oorang

Description:

Returns a GUID in a string. 

Discussion:

There are many reasons why you would want an ID or name that is reasonably certain to be unique. Tagging your custom controls, as a primary key, for temp files etc. This shows a very simple way to create one. 

Code:

instructions for use

			

Public Sub TestGetGUID() MsgBox GetGUID, vbInformation, "GUID Generated" End Sub Public Function GetGUID() As String GetGUID = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36) End Function

How to use:

  1. Press Alt F11 to launch the VBE (Visual Basic Editor).
  2. From the VBE's insert menu, select "Module".
  3. Paste the code above.
 

Test the code:

  1. Run the TestGetGUID procedure.
 

Sample File:

GUID_List.zip 22.88KB 

Approved by mdmackillop


This entry has been viewed 401 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express