Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upper level directory with a space in the name.

Status
Not open for further replies.

shagymoe

Programmer
Apr 20, 2001
72
US
I got some good help on how to create a directory with the current date as the name with this command:

MkDir "C:\" & Format(Now, "mm-dd-yy")

But, one of the higher level directories has a space in the name and VB doesn't like that....is there a way around this?

It looks like this:

MkDir "C:\folder1\folder2\folder 3\" & Format(Now, "mm-dd-yy")

Notice the space in "folder 3"
 
I do. Its nothing to do with the space. make each level separatly Peter Meachem
peter@accuflight.com
 
I'm not sure what you mean because folder1, folder2 and folder 3 already exist.
And I cannot rename folder 3 because of links in other programs
 
Ok I did this and it worked for me

MkDir "C:\folder1\"
MkDir "C:\folder1\folder2\"
MkDir "C:\folder1\folder2\folder 3\"
MkDir "C:\folder1\folder2\folder 3\" & Format(Now, "mm-dd-yy")

Peter Meachem
peter@accuflight.com
 
Yep, you are right.....it worked for me too with the example, but not with the real code. Here it is:

Private Sub cmdMkDir_Click()
MkDir "O:\exel\ceco_dc\g out\" & Format(Now, "mm-dd-yy")
End Sub

I get:

run time error '75':
path/file access error

but when i take out the "g out" it works with no errors.

Such as:

Private Sub cmdMkDir_Click()
MkDir "O:\exel\ceco_dc\" & Format(Now, "mm-dd-yy")
End Sub

 
Uggh...nevermind.....now it DOES WORK! VB......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top