I believe this issue is a result of a recent update to MS Office/Access or Windows 10. When I run this code:
Dim s As String
With CreateObject(\"Scriptlet.T
In Access, we can suffice with this very short function to generate a GUID by leveraging Application.StringFromGUID to cast bytes to a GUID. It generates pretty verbose GUIDs, though, with the format {guid {00000000-0000-0000-0000-000000000000}}.
Declare PtrSafe Sub CoCreateGuid Lib "ole32" (ByVal GUID As LongPtr)
Public Function NewGUID() As String
Dim b(15) As Byte
CoCreateGUID VarPtr(b(0))
NewGUID = Application.StringFromGUID(b)
End Function
You can strip away unwanted characters, for example by replacing the last line of this function with NewGUID = Mid(Application.StringFromGUID(b), 8, 36). Then, the format will be 00000000-0000-0000-0000-000000000000