Eljefegeneo
Still trying to learn
- Local time
- Today, 10:12
- Joined
- Jan 10, 2011
- Messages
- 902
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