I've made some mods to your UDF to make it a bit more simple for (my) typical use.
Code:
$ld = 'CN=MIS,CN=Users,DC=domain,DC=com'
? TranslateName($ld,1,3)
? TranslateName(@userid)
Function TranslateName($LookupName, optional $LookupNameType, optional $ReturnNameType, optional $InitType, optional $BindName)
Dim $NameTranslate
if not $LookupNameType and not instr($LookupName,'\') $LookupName = @domain+'\'+$LookupName endif
if not $LookupNameType $LookupNameType=3 endif
if not $ReturnNameType $ReturnNameType=1 endif
if not $InitType $InitType=1 endif
if not $BindName $BindName=@domain endif
if $InitType = 3 $BindName='' endif
$NameTranslate = CREATEOBJECT("NameTranslate") if @error Exit 1 endif
$NameTranslate.Init($InitType, $BindName) if @error Exit 2 endif
$NameTranslate.Set($LookupNameType, $LookupName) if @error Exit 3 endif
$TranslateName = $NameTranslate.Get($ReturnNameType)
Endfunction
I just thought I'd put it out here...