View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default MkDir Simply Not Creating Folders

I misread your post, but your code is all screwed up.

This
sProfileName = "C:\test"

combined with
MkDir sPath & sProfileName


looks backwards. You should have

sPath = "C:\Test"
and sProfileName contains a subfolder name, and then use code like

MkDir sPath & "\" & sProfileName


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)




"Chip Pearson" wrote in message
...
Does the sProfileName contain a leading backslash? You may need to change

MkDir sPath & sProfileName

to

MkDir sPath & "\" & sProfileName


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



wrote in message
oups.com...
I know this will sound odd, but the MkDir function isn't creating
folders... and it isn't throwing any errors.

I don't have any "On Error Resume Next" anywhere in my code. It just
isn't creating any folders. The folder doesn't already exist and it
isn't trying to create multi-level folder structures or anything like
that. I just want to create a folder named "test" on my root drive
(C:\ in this case). Here's the code:

Private Sub CreateFolder()

sProfileName = "C:\test"
'On Error GoTo folderexists
MkDir sPath & sProfileName
'Exit Sub

'folderexists:
'Exit Sub
End Sub