Multiple Apps

Create a GUID (Globally Unique Identifier)

Ease of Use


Version tested with


Submitted by:



Returns a GUID in a string. 


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. 


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: 22.88KB 

Approved by mdmackillop

This entry has been viewed 411 times.

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