People in my company have different desktop pathing, and I'm struggling to account for them all. I tried using the underlying code, but it's failing for one person (so far):
His desktop path has a space after the username that isn't being picked up when I run the code above, or Environ("Username"). Is there a way to capture the User's desktop path in these scenarios?
VBA Code:
Sub pathtest()
Dim uDP As String
uDP = CreateObject("WScript.Shell").SpecialFolders("Desktop")
If Len(Dir(uDP & "\Test", vbDirectory)) = 0 Then
MkDir uDP & "\Test"
End If
End Sub
His desktop path has a space after the username that isn't being picked up when I run the code above, or Environ("Username"). Is there a way to capture the User's desktop path in these scenarios?