Hi,
Your code works fine, it's just where you are placing it that is the problem. It needs to go into a sub or function which is why you are getting your error.
Try placing it in an event sub such as:
Code:
'place a command button on your form
Private Sub Command1_Click()
Dim dirname As String, newdir As String
Dim f As String

dirname = "C:\Dev\"
newdir = dirname & "NEWDIR"

MkDir newdir
newdir = newdir + "\"
End Sub
'The code will run when you click Command1
or place it in a function like:
Code:
Private Function MakeFolder(NewDir as String)
Dim dirname As String

dirname = "C:\Dev\"
NewDir = dirname & NewDir

MkDir NewDir
End Function
and then you could call this function like:
Code:
Private Sub Form_Load()
MakeFolder("NameOfNewDIR")
End Sub
Hope this helps

Shaun