Re: Converting GUID to "packed" GUID

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"John Paulsson" <etique@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:#wCimwg1FHA.736@xxxxxxxxxxxxxxxxxxxxxxx
> McKirahan wrote:
> > "John Paulsson" <etique@xxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:#lubc4c1FHA.2004@xxxxxxxxxxxxxxxxxxxxxxx
> >> How do you convert a GUID like {E09B48B5-E141-427A-AB0C-D3605127224A}
to
> >> the packed (commonly used in the registry) format like
> >> 5B84B90E141EA724BAC03D06157222A4?
> >
> > Dim sGUID
> > sGUID = "E09B48B5-E141-427A-AB0C-D3605127224A"
> > WScript.Echo sGUID & vbCrLf & Replace(sGUID,"-",""))
>
> Have a look at the compressed GUID format again..

Sorry, I didn't notice that the "packed" format is the concatenation
of the reverse of each GUID dash-separated "chunk".

Will this work?

WScript.Echo PackGUID("{E09B48B5-E141-427A-AB0C-D3605127224A}")

Function PackGUID(guid)
PackGUID = ""
'*
Dim temp
temp = Mid(guid,2,Len(guid)-2)
Dim part
part = Split(temp,"-")
Dim pack
pack = ""
Dim i, j
For i = 0 To UBound(part)
For j = Len(part(i)) To 1 Step -1
pack = pack & Mid(part(i),j,1)
Next
Next
'*
PackGUID = pack
End Function


.



Relevant Pages

  • Re: Setting field properties in code
    ... format that the user has defined in the Windows Control Panel, ... >> Sub StandardProperties(strTableName As String) ... >> Dim tdf As DAO.TableDef 'Table nominated in argument. ... >> Dim ind As DAO.Index ...
    (comp.databases.ms-access)
  • Re: Conditional format problem
    ... an Excel 5.0/95 format file, ... Anyone know how to save in a later Excel format from Access? ... Dim oXL As Object ... Dim strCondition1 As String ...
    (microsoft.public.excel.programming)
  • Re: Mail Merge HTML Format Word 2002 XP SP3
    ... HTML format as you have no control over how the recipient reads them. ... 'Creates a new e-mail item and modifies its properties. ... Dim olApp As Outlook.Application ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Generating a column based on import file name
    ... is d/m/yy as opposed to the format shown. ... Dim lReturn As Long ... .TextFilePlatform = xlWindows ... importing. ...
    (microsoft.public.excel.programming)
  • Re: tab in userform locks program
    ... > I am a VBA newbie and have not been using DIM in my code so it is ... declare a variable at the top of a standard module using Private (module ... You may notice that I used Format$ instead of Format. ... but Format$ returns a String whereas ...
    (microsoft.public.excel.programming)