Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default MkDir Simply Not Creating Folders

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default MkDir Simply Not Creating Folders

Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default MkDir Simply Not Creating Folders

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default MkDir Simply Not Creating Folders

I'm not sure why it's not working for you. Your code works for me. Are you
able to manually create a folder through Windows Explorer? If you run this
code twice in a row, will it give you an error? Just in case, refresh
Windows Explorer (F5).

Regards,
Paul


wrote in message
oups.com...
Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default MkDir Simply Not Creating Folders

Are you on Vista ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message oups.com...
Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
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





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default MkDir Simply Not Creating Folders

Ron,

I haven't installed Vista yet. Is there an issue with MkDir?


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


"Ron de Bruin" wrote in message
...
Are you on Vista ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
oups.com...
Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default MkDir Simply Not Creating Folders

Hi Chip

Vista have protected parts of the hard disk.
Maybe there is no permission for C:\

I not test the MKdir on C but if you want to save a file on C you will see a permission dialog.

With this text

"You don't have permission to save in this location"
"Would you like to save in the Documents folder instead?"

But maybe creating a folder with code is no problem?
I check it out this evening



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chip Pearson" wrote in message ...
Ron,

I haven't installed Vista yet. Is there an issue with MkDir?


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


"Ron de Bruin" wrote in message
...
Are you on Vista ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
oups.com...
Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default MkDir Simply Not Creating Folders

Creating a folder in C:\ is no problem Chip in Vista
Only saving your test macros with code in C:\ because the path is short<g is not possible
in Vista anymore.


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" wrote in message ...
Hi Chip

Vista have protected parts of the hard disk.
Maybe there is no permission for C:\

I not test the MKdir on C but if you want to save a file on C you will see a permission dialog.

With this text

"You don't have permission to save in this location"
"Would you like to save in the Documents folder instead?"

But maybe creating a folder with code is no problem?
I check it out this evening



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chip Pearson" wrote in message ...
Ron,

I haven't installed Vista yet. Is there an issue with MkDir?


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


"Ron de Bruin" wrote in message
...
Are you on Vista ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message
oups.com...
Sorry, this new interface on Google Groups just posted on it's own...
anyway...

Notice I've commented out the error handling to try and force an error.
sProfileName is a string, of course, and sPath is empty on purpose for
testing. I just want to create a "test" folder on the C drive and it's
not working, causing an error, or anything.

Any help is hugely appreciated!!

Cory

On Jan 24, 12:44 pm, "
wrote:
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating List From Folders Don Excel Programming 12 August 11th 06 12:47 AM
Help with Creating folders on Save Alarmbloke Excel Discussion (Misc queries) 3 December 22nd 05 06:00 PM
Creating folders using VBA Fred Smith Excel Programming 2 May 8th 05 03:27 PM
Creating folders with VB Foss Excel Programming 2 February 24th 04 10:08 AM
Creating Folders from Excel Using OLE Automation Bob C. Excel Programming 5 December 6th 03 03:57 PM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"