Make Directory Problem (1 Viewer)

Eljefegeneo

Still trying to learn
Local time
Today, 00:03
Joined
Jan 10, 2011
Messages
904
I am trying to figure out why the first code seems to work and the second doesn’t. I am trying to create a folder on Dropbox using VBA so that I don’t need to know the user (or computer) name to do it.

Code:
Dim myPath As String
Dim myFolder As String
myFolder = myPath & "AAAAA"
myPath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & myFolder

'Tests to see if folder exists on Desktop
Dim IsDir As Boolean
If Len(Dir(myPath, vbDirectory)) = 0 Then
IsDir = False

'If folder does not exist, make a folder on the Desktop
MkDir myPath
End If



Code:
 Dim myPath As String
Dim myFolder As String
myFolder = myPath & "AAAAA"
myPath = CreateObject("WScript.Shell").SpecialFolders("Dropbox") & "\" & myFolder

'Tests to see if folder exists on Desktop
Dim IsDir As Boolean
If Len(Dir(myPath, vbDirectory)) = 0 Then
IsDir = False
'If folder does not exist, make a folder on the Desktop
MkDir myPath
End If
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:03
Joined
May 7, 2009
Messages
19,232
i don't think there is a "special" folder called dropbox?
 

Eljefegeneo

Still trying to learn
Local time
Today, 00:03
Joined
Jan 10, 2011
Messages
904
Yes, thank you, now I understand. I figured out another way of doing it, a little more complicated, but it works.
 

Users who are viewing this thread

Top Bottom