You should use @UniqueID, not NoteID. NoteID is database specific. @UniqueID is good across multiple replicas of a database.
But, to answer the question, Take the characters off that you don't want, if there is a set pattern to the padding. I have never used NoteID for anything, but something like this may work.
@rightback(@noteid, 5)
This assumes that the padding is always the same number of characters. If not, you will have to be more clever in your formula, checking for NT and finding the number of 0s, then trimming away what you don't want. You may have to use a formula loop to trim the padding from the beginning of the string until you get a character that is not an N, a T or a 0, then leave the remainder.
Not too hard to do, and can be fun.
Final Results by Maramor
<pre>
Dim pathName As String
Dim dirName As String
Dim dirPad As String
Dim dirPadLength As Integer
pathName = "C:samples"
dirName = doc.NoteID
dirPadLength = 8 - Len(dirName)
dirPad = "NT"
For i = 1 To dirPadLength
dirPad = dirPad & "0"
Next
dirName = dirPad & dirName
Mkdir pathName & "" & dirName
</pre>